public void save ( Path filename , boolean pretty ) throws IOException { if ( filename == null || Files . exists ( filename ) ) { throw new IOException ( "File path not correct, either it is null or file already exists: " + filename ) ; } String text ; if ( pretty ) { text = mapper . writerWithDefaultPrettyPrinter ( ) . writeValueAsString ( variantMetadata ) ; } else { text = mapper . writeValueAsString ( variantMetadata ) ; } PrintWriter writer = new PrintWriter ( new FileOutputStream ( filename . toFile ( ) ) ) ; writer . write ( text ) ; writer . close ( ) ; }
Save variant metadata manager in JSON format into the given filename .