public static void saveWorkspaceToJson ( Workspace workspace , File file ) throws Exception { if ( workspace == null ) { throw new IllegalArgumentException ( "A workspace must be provided." ) ; } else if ( file == null ) { throw new IllegalArgumentException ( "The path to a JSON file must be specified." ) ; } OutputStreamWriter writer = new OutputStreamWriter ( new FileOutputStream ( file ) , StandardCharsets . UTF_8 ) ; new JsonWriter ( true ) . write ( workspace , writer ) ; writer . flush ( ) ; writer . close ( ) ; }
Saves a workspace to a JSON definition as a file .