public static ByteArrayInputStream storeProperties ( Map < String , String > propertiesMap ) throws StorageException { // Pull out known computed values propertiesMap . remove ( StorageProvider . PROPERTIES_SPACE_COUNT ) ; // Serialize Map byte [ ] properties = null ; try { String serializedProperties = serializeMap ( propertiesMap ) ; properties = serializedProperties . getBytes ( "UTF-8" ) ; } catch ( Exception e ) { String err = "Could not store properties" + " due to error: " + e . getMessage ( ) ; throw new StorageException ( err ) ; } ByteArrayInputStream is = new ByteArrayInputStream ( properties ) ; return is ; }
Converts properties stored in a Map into a stream for storage purposes .