@Override @SuppressWarnings("deprecation") protected char[] applyJsonQuoting(String content) { return JsonStringEncoder.getInstance().quoteAsString(content); }
/** * @since 2.8 */ protected final DataInput _decorate(DataInput in, IOContext ctxt) throws IOException { if (_inputDecorator != null) { DataInput in2 = _inputDecorator.decorate(ctxt, in); if (in2 != null) { return in2; } } return in; }
/** * This method should be called along with (or instead of) normal * close. After calling this method, no further reads should be tried. * Method will try to recycle read buffers (if any). */ private void freeBuffers() { byte[] buf = _buffer; if (buf != null) { _buffer = null; _context.releaseReadIOBuffer(buf); } }
public ByteSourceJsonBootstrapper(IOContext ctxt, InputStream in) { _context = ctxt; _in = in; _inputBuffer = ctxt.allocReadIOBuffer(); _inputEnd = _inputPtr = 0; // _inputProcessed = 0; _bufferRecyclable = true; }
public UTF8Writer(IOContext ctxt, OutputStream out) { _context = ctxt; _out = out; _outBuffer = ctxt.allocWriteEncodingBuffer(); /* Max. expansion for a single char (in unmodified UTF-8) is * 4 bytes (or 3 depending on how you view it -- 4 when recombining * surrogate pairs) */ _outBufferEnd = _outBuffer.length - 4; _outPtr = 0; }
public WriterBasedJsonGenerator(IOContext ctxt, int features, ObjectCodec codec, Writer w) { super(ctxt, features, codec); _writer = w; _outputBuffer = ctxt.allocConcatBuffer(); _outputEnd = _outputBuffer.length; }
/** * @since 2.4 */ protected final OutputStream _decorate(OutputStream out, IOContext ctxt) throws IOException { if (_outputDecorator != null) { OutputStream out2 = _outputDecorator.decorate(ctxt, out); if (out2 != null) { return out2; } } return out; }
@Override public JsonGenerator setCharacterEscapes(CharacterEscapes esc) { _characterEscapes = esc; if (esc == null) { // revert to standard escapes _outputEscapes = sOutputEscapes; } else { _outputEscapes = esc.getEscapeCodesForAscii(); } return this; }
/** * @since 2.9 */ private char[] _allocateCopyBuffer() { if (_charBuffer == null) { _charBuffer = _ioContext.allocNameCopyBuffer(2000); } return _charBuffer; }
@Override public void write(char[] cbuf) throws IOException { write(cbuf, 0, cbuf.length); }
@Override public Writer append(char c) { write(c); return this; }
/** * @since 2.8 */ protected void _reportInvalidEOF(String msg, JsonToken currToken) throws JsonParseException { throw new JsonEOFException(this, currToken, "Unexpected end-of-input"+msg); }
protected final void _verifyRelease(byte[] toRelease, byte[] src) { // 07-Mar-2016, tatu: As per [core#255], only prevent shrinking of buffer if ((toRelease != src) && (toRelease.length < src.length)) { throw wrongBuf(); } }
/** * @since 2.8 */ protected OutputStream _createDataOutputWrapper(DataOutput out) { return new DataOutputAsStream(out); }
/** * @since 2.4 */ protected final InputStream _decorate(InputStream in, IOContext ctxt) throws IOException { if (_inputDecorator != null) { InputStream in2 = _inputDecorator.decorate(ctxt, in); if (in2 != null) { return in2; } } return in; }
private void _free() { byte[] buf = _b; if (buf != null) { _b = null; if (_ctxt != null) { _ctxt.releaseReadIOBuffer(buf); } } } }
/** * @since 2.4 */ protected final Writer _decorate(Writer out, IOContext ctxt) throws IOException { if (_outputDecorator != null) { Writer out2 = _outputDecorator.decorate(ctxt, out); if (out2 != null) { return out2; } } return out; }
@Override public Writer append(char c) throws IOException { write(c); return this; }
/** * @since 2.4 */ protected final Reader _decorate(Reader in, IOContext ctxt) throws IOException { if (_inputDecorator != null) { Reader in2 = _inputDecorator.decorate(ctxt, in); if (in2 != null) { return in2; } } return in; }