/** * Alternative constructor that may be used to feed partially initialized content. * * @param outputBuffer Buffer to use for output before flushing to the underlying stream * @param offset Offset pointing past already buffered content; that is, number of bytes of valid content * to output, within buffer. */ public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures, ObjectCodec codec, OutputStream out, byte[] outputBuffer, int offset, boolean bufferRecyclable) { super(stdFeatures, codec); _formatFeatures = formatFeatures; _cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures); _ioContext = ctxt; _out = out; _bufferRecyclable = bufferRecyclable; _outputTail = offset; _outputBuffer = outputBuffer; _outputEnd = _outputBuffer.length; _charBuffer = ctxt.allocConcatBuffer(); _charBufferLength = _charBuffer.length; // let's just sanity check to prevent nasty odd errors if (_outputEnd < MIN_BUFFER_LENGTH) { throw new IllegalStateException("Internal encoding buffer length ("+_outputEnd +") too short, must be at least "+MIN_BUFFER_LENGTH); } }
/** * Alternative constructor that may be used to feed partially initialized content. * * @param outputBuffer Buffer to use for output before flushing to the underlying stream * @param offset Offset pointing past already buffered content; that is, number of bytes of valid content * to output, within buffer. */ public CBORGenerator(IOContext ctxt, int jsonFeatures, int formatFeatures, ObjectCodec codec, OutputStream out, byte[] outputBuffer, int offset, boolean bufferRecyclable) { super(jsonFeatures, codec); _formatFeatures = formatFeatures; _cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures); _ioContext = ctxt; _out = out; _bufferRecyclable = bufferRecyclable; _outputTail = offset; _outputBuffer = outputBuffer; _outputEnd = _outputBuffer.length; _charBuffer = ctxt.allocConcatBuffer(); _charBufferLength = _charBuffer.length; // let's just sanity check to prevent nasty odd errors if (_outputEnd < MIN_BUFFER_LENGTH) { throw new IllegalStateException("Internal encoding buffer length ("+_outputEnd +") too short, must be at least "+MIN_BUFFER_LENGTH); } }
/** * Alternative constructor that may be used to feed partially initialized content. * * @param outputBuffer * Buffer to use for output before flushing to the underlying stream * @param offset * Offset pointing past already buffered content; that is, number * of bytes of valid content to output, within buffer. */ public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures, ObjectCodec codec, OutputStream out, byte[] outputBuffer, int offset, boolean bufferRecyclable) { super(stdFeatures, codec); _formatFeatures = formatFeatures; _cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures); _ioContext = ctxt; _out = out; _bufferRecyclable = bufferRecyclable; _outputTail = offset; _outputBuffer = outputBuffer; _outputEnd = _outputBuffer.length; _charBuffer = ctxt.allocConcatBuffer(); _charBufferLength = _charBuffer.length; // let's just sanity check to prevent nasty odd errors if (_outputEnd < MIN_BUFFER_LENGTH) { throw new IllegalStateException("Internal encoding buffer length (" + _outputEnd + ") too short, must be at least " + MIN_BUFFER_LENGTH); } }
public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures, ObjectCodec codec, OutputStream out) { super(stdFeatures, codec); _formatFeatures = formatFeatures; _cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures); _ioContext = ctxt; _out = out; _bufferRecyclable = true; _outputBuffer = ctxt.allocWriteEncodingBuffer(BYTE_BUFFER_FOR_OUTPUT); _outputEnd = _outputBuffer.length; _charBuffer = ctxt.allocConcatBuffer(); _charBufferLength = _charBuffer.length; // let's just sanity check to prevent nasty odd errors if (_outputEnd < MIN_BUFFER_LENGTH) { throw new IllegalStateException("Internal encoding buffer length ("+_outputEnd +") too short, must be at least "+MIN_BUFFER_LENGTH); } }
public CBORGenerator(IOContext ctxt, int jsonFeatures, int formatFeatures, ObjectCodec codec, OutputStream out) { super(jsonFeatures, codec); _formatFeatures = formatFeatures; _cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures); _ioContext = ctxt; _out = out; _bufferRecyclable = true; _outputBuffer = ctxt.allocWriteEncodingBuffer(BYTE_BUFFER_FOR_OUTPUT); _outputEnd = _outputBuffer.length; _charBuffer = ctxt.allocConcatBuffer(); _charBufferLength = _charBuffer.length; // let's just sanity check to prevent nasty odd errors if (_outputEnd < MIN_BUFFER_LENGTH) { throw new IllegalStateException("Internal encoding buffer length ("+_outputEnd +") too short, must be at least "+MIN_BUFFER_LENGTH); } }
public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures, ObjectCodec codec, OutputStream out) { super(stdFeatures, codec); _formatFeatures = formatFeatures; _cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures); _ioContext = ctxt; _out = out; _bufferRecyclable = true; _outputBuffer = ctxt.allocWriteEncodingBuffer(BYTE_BUFFER_FOR_OUTPUT); _outputEnd = _outputBuffer.length; _charBuffer = ctxt.allocConcatBuffer(); _charBufferLength = _charBuffer.length; // let's just sanity check to prevent nasty odd errors if (_outputEnd < MIN_BUFFER_LENGTH) { throw new IllegalStateException("Internal encoding buffer length (" + _outputEnd + ") too short, must be at least " + MIN_BUFFER_LENGTH); } }
private final CBORGenerator _createCBORGenerator(IOContext ctxt, int stdFeat, int formatFeat, ObjectCodec codec, OutputStream out) throws IOException { // false -> we won't manage the stream unless explicitly directed to CBORGenerator gen = new CBORGenerator(ctxt, stdFeat, formatFeat, _objectCodec, out); if (CBORGenerator.Feature.WRITE_TYPE_HEADER.enabledIn(formatFeat)) { gen.writeTag(CBORConstants.TAG_ID_SELF_DESCRIBE); } return gen; }
@Override public JsonGenerator overrideFormatFeatures(int values, int mask) { int oldState = _formatFeatures; int newState = (_formatFeatures & ~mask) | (values & mask); if (oldState != newState) { _formatFeatures = newState; _cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(newState); } return this; }
@Override public JsonGenerator overrideFormatFeatures(int values, int mask) { int oldState = _formatFeatures; int newState = (_formatFeatures & ~mask) | (values & mask); if (oldState != newState) { _formatFeatures = newState; _cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(newState); } return this; }
private final CBORGenerator _createCBORGenerator(IOContext ctxt, int stdFeat, int formatFeat, ObjectCodec codec, OutputStream out) throws IOException { // false -> we won't manage the stream unless explicitly directed to CBORGenerator gen = new CBORGenerator(ctxt, stdFeat, formatFeat, _objectCodec, out); if (CBORGenerator.Feature.WRITE_TYPE_HEADER.enabledIn(formatFeat)) { gen.writeTag(CBORConstants.TAG_ID_SELF_DESCRIBE); } return gen; }
private final CBORGenerator _createCBORGenerator(IOContext ctxt, int stdFeat, int formatFeat, ObjectCodec codec, OutputStream out) throws IOException { // false -> we won't manage the stream unless explicitly directed to CBORGenerator gen = new CBORGenerator(ctxt, stdFeat, formatFeat, _objectCodec, out); if (CBORGenerator.Feature.WRITE_TYPE_HEADER.enabledIn(formatFeat)) { gen.writeTag(CBORConstants.TAG_ID_SELF_DESCRIBE); } return gen; }