Package org.bson.json
Interface StrictJsonWriter
- 
- All Known Implementing Classes:
- StrictCharacterStreamJsonWriter
 
 public interface StrictJsonWriterAn interface for creating JSON texts that largely conform to RFC 7159.- Since:
- 3.5
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisTruncated()Return true if the output has been truncated due to exceeding any maximum length specified in settings.voidwriteBoolean(boolean value)Writes a boolean to the writer.voidwriteBoolean(String name, boolean value)Writes a a member with a boolean value to the writer.voidwriteEndArray()Writes the end of a JSON array to the writer.voidwriteEndObject()Writes the end of a JSON object to the writer.voidwriteName(String name)Writes the name of a member to the writer.voidwriteNull()Writes a null value to the writer.voidwriteNull(String name)Writes a member with a null value to the writer.voidwriteNumber(String value)Writes a number to the writer.voidwriteNumber(String name, String value)Writes a member with a numeric value to the writer.voidwriteRaw(String value)Writes a raw value without quoting or escaping.voidwriteRaw(String name, String value)Writes a member with a raw value without quoting or escaping.voidwriteStartArray()Writes the start of a array to the writer.voidwriteStartArray(String name)Writes the start of JSON array member to the writer.voidwriteStartObject()Writes the start of a JSON object to the writer.voidwriteStartObject(String name)Writes the start of a JSON object member to the writer.voidwriteString(String value)Writes a String to the writer.voidwriteString(String name, String value)Writes a member with a string value to the writer.
 
- 
- 
- 
Method Detail- 
writeNamevoid writeName(String name) Writes the name of a member to the writer.- Parameters:
- name- the member name
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a member name
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeBooleanvoid writeBoolean(boolean value) Writes a boolean to the writer.- Parameters:
- value- the boolean value.
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a value
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeBooleanvoid writeBoolean(String name, boolean value) Writes a a member with a boolean value to the writer.- Parameters:
- name- the member name
- value- the boolean value
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a member
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeNumbervoid writeNumber(String value) Writes a number to the writer.- Parameters:
- value- the Double value, as a String so that clients can take full control over formatting
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a value
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeNumbervoid writeNumber(String name, String value) Writes a member with a numeric value to the writer.- Parameters:
- name- the member name
- value- the Double value, as a String so that clients can take full control over formatting
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a member
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeStringvoid writeString(String value) Writes a String to the writer.- Parameters:
- value- the String value
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a value
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeStringvoid writeString(String name, String value) Writes a member with a string value to the writer.- Parameters:
- name- the member name
- value- the String value
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a member
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeRawvoid writeRaw(String value) Writes a raw value without quoting or escaping.- Parameters:
- value- the String value
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a value
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeRawvoid writeRaw(String name, String value) Writes a member with a raw value without quoting or escaping.- Parameters:
- name- the member name
- value- the raw value
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a member
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeNullvoid writeNull() Writes a null value to the writer.- Throws:
- BsonInvalidOperationException- if not in the correct state to write a value
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeNullvoid writeNull(String name) Writes a member with a null value to the writer.- Parameters:
- name- the member name
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a member
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeStartArrayvoid writeStartArray() Writes the start of a array to the writer.- Throws:
- BsonInvalidOperationException- if not in the correct state to write a value
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeStartArrayvoid writeStartArray(String name) Writes the start of JSON array member to the writer.- Parameters:
- name- the member name
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a member
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeStartObjectvoid writeStartObject() Writes the start of a JSON object to the writer.- Throws:
- BsonInvalidOperationException- if not in the correct state to write a value
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeStartObjectvoid writeStartObject(String name) Writes the start of a JSON object member to the writer.- Parameters:
- name- the member name
- Throws:
- BsonInvalidOperationException- if not in the correct state to write a member
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeEndArrayvoid writeEndArray() Writes the end of a JSON array to the writer.- Throws:
- BsonInvalidOperationException- if not in the correct state to write the end of an array
- BSONException- if the underlying Writer throws an IOException
 
 - 
writeEndObjectvoid writeEndObject() Writes the end of a JSON object to the writer.- Throws:
- BsonInvalidOperationException- if not in the correct state to write the end of an object
- BSONException- if the underlying Writer throws an IOException
 
 - 
isTruncatedboolean isTruncated() Return true if the output has been truncated due to exceeding any maximum length specified in settings.- Returns:
- true if the output has been truncated
- Since:
- 3.7
 
 
- 
 
-