Package org.bson.json

Class JsonWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, BsonWriter

    public class JsonWriter
    extends AbstractBsonWriter
    A BsonWriter implementation that outputs a JSON representation of BSON.
    Since:
    3.0
    • Constructor Detail

      • JsonWriter

        public JsonWriter​(java.io.Writer writer)
        Creates a new instance which uses writer to write JSON to.
        Parameters:
        writer - the writer to write JSON to.
      • JsonWriter

        public JsonWriter​(java.io.Writer writer,
                          JsonWriterSettings settings)
        Creates a new instance which uses writer to write JSON to and uses the given settings.
        Parameters:
        writer - the writer to write JSON to.
        settings - the settings to apply to this writer.
    • Method Detail

      • getWriter

        public java.io.Writer getWriter()
        Gets the Writer.
        Returns:
        the writer
      • doWriteBoolean

        public void doWriteBoolean​(boolean value)
      • doWriteNull

        public void doWriteNull()
      • doWriteObjectId

        public void doWriteObjectId​(ObjectId objectId)
      • doWriteRegularExpression

        public void doWriteRegularExpression​(BsonRegularExpression regularExpression)
      • doWriteString

        public void doWriteString​(java.lang.String value)
      • doWriteSymbol

        public void doWriteSymbol​(java.lang.String value)
      • doWriteTimestamp

        public void doWriteTimestamp​(BsonTimestamp value)
      • doWriteUndefined

        public void doWriteUndefined()
      • flush

        public void flush()
        Description copied from interface: BsonWriter
        Flushes any pending data to the output destination.