public void write ( EncryptedWorkspace workspace , Writer writer ) throws WorkspaceWriterException { if ( workspace == null ) { throw new IllegalArgumentException ( "EncryptedWorkspace cannot be null." ) ; } if ( writer == null ) { throw new IllegalArgumentException ( "Writer cannot be null." ) ; } try { ObjectMapper objectMapper = new ObjectMapper ( ) ; if ( indentOutput ) { objectMapper . enable ( SerializationFeature . INDENT_OUTPUT ) ; } objectMapper . setSerializationInclusion ( JsonInclude . Include . NON_NULL ) ; objectMapper . setSerializationInclusion ( JsonInclude . Include . NON_EMPTY ) ; objectMapper . disable ( SerializationFeature . WRITE_DATES_AS_TIMESTAMPS ) ; objectMapper . setDateFormat ( new ISO8601DateFormat ( ) ) ; writer . write ( objectMapper . writeValueAsString ( workspace ) ) ; } catch ( Exception e ) { throw new WorkspaceWriterException ( "Could not write as JSON" , e ) ; } }
Writes an encrypted workspace definition as a JSON string to the specified Writer object .