public void writeObject ( Writer writer , int indentDepth , boolean contentOnly , boolean compact ) throws IOException { if ( logger . isLoggable ( Level . FINER ) ) logger . entering ( className , "writeObject(Writer, int, boolean, boolean)" ) ; if ( writer != null ) { try { if ( isEmptyObject ( ) ) { writeEmptyObject ( writer , indentDepth , contentOnly , compact ) ; } else if ( isTextOnlyObject ( ) ) { writeTextOnlyObject ( writer , indentDepth , contentOnly , compact ) ; } else { writeComplexObject ( writer , indentDepth , contentOnly , compact ) ; } } catch ( Exception ex ) { IOException iox = new IOException ( "Error occurred on serialization of JSON text." ) ; iox . initCause ( ex ) ; throw iox ; } } else { throw new IOException ( "The writer cannot be null." ) ; } if ( logger . isLoggable ( Level . FINER ) ) logger . entering ( className , "writeObject(Writer, int, boolean, boolean)" ) ; }
Method to write out the JSON formatted object .