private static PrettyPrinter initSsePrettyPrinter() { DefaultPrettyPrinter printer = new DefaultPrettyPrinter(); printer.indentObjectsWith(new DefaultIndenter(" ", "\ndata:")); return printer; }
/** * Clean up method to call to release all buffers this object may be * using. After calling the method, no other accessors can be used (and * attempt to do so may result in an exception) */ public void release() { reset(); if (_bufferRecycler != null && _currBlock != null) { _bufferRecycler.releaseByteBuffer(BufferRecycler.BYTE_WRITE_CONCAT_BUFFER, _currBlock); _currBlock = null; } }
public ByteArrayBuilder _getByteArrayBuilder() { if (_byteArrayBuilder == null) { _byteArrayBuilder = new ByteArrayBuilder(); } else { _byteArrayBuilder.reset(); } return _byteArrayBuilder; }
/** * Method called when starting "manual" output: will clear out * current state and return the first segment buffer to fill */ public byte[] resetAndGetFirstSegment() { reset(); return _currBlock; }
@Override public void beforeObjectEntries(JsonGenerator g) throws IOException { _objectIndenter.writeIndentation(g, _nesting); }
@Override protected char _decodeEscaped() throws IOException { VersionUtil.throwInternal(); return ' '; }
public void append(int i) { if (_currBlockPtr >= _currBlock.length) { _allocMore(); } _currBlock[_currBlockPtr++] = (byte) i; }
/** * @param ix One of <code>READ_IO_BUFFER</code> constants. */ public final byte[] allocByteBuffer(int ix) { return allocByteBuffer(ix, 0); }
public PrettyPrinter constructDefaultPrettyPrinter() { PrettyPrinter pp = _defaultPrettyPrinter; if (pp instanceof Instantiatable<?>) { pp = (PrettyPrinter) ((Instantiatable<?>) pp).createInstance(); } return pp; }
public void resetWithString(String value) { _inputBuffer = null; _inputStart = -1; _inputLen = 0; _resultString = value; _resultArray = null; if (_hasSegments) { clearSegments(); } _currentSize = 0; }
/** * Method called to make sure that buffer is not using shared input * buffer; if it is, it will copy such contents to private buffer. */ public void ensureNotShared() { if (_inputStart >= 0) { unshare(16); } }
/** * "Mutant factory" method that will return a pretty printer instance * that does use spaces inside object entries; if 'this' instance already * does this, it is returned; if not, a new instance will be constructed * and returned. * * @since 2.3 */ public DefaultPrettyPrinter withSpacesInObjectEntries() { return _withSpaces(true); }
public char[] contentsAsArray() { char[] result = _resultArray; if (result == null) { _resultArray = result = resultArray(); } return result; }
/** * Sets the String request payload * * @since 2.8 */ public void setRequestPayloadOnError(String payload) { _requestPayload = (payload == null) ? null : new RequestPayload(payload); }
protected AbstractJackson2HttpMessageConverter(ObjectMapper objectMapper) { this.objectMapper = objectMapper; setDefaultCharset(DEFAULT_CHARSET); DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter(); prettyPrinter.indentObjectsWith(new DefaultIndenter(" ", "\ndata:")); this.ssePrettyPrinter = prettyPrinter; }
/** * Method called when the current segment buffer is full; will * append to current contents, allocate a new segment buffer * and return it */ public byte[] finishCurrentSegment() { _allocMore(); return _currBlock; }
/** * "Mutant factory" method that will return a pretty printer instance * that does not use spaces inside object entries; if 'this' instance already * does this, it is returned; if not, a new instance will be constructed * and returned. * * @since 2.3 */ public DefaultPrettyPrinter withoutSpacesInObjectEntries() { return _withSpaces(false); }
/** * Sets the byte[] request payload and the charset * * @since 2.8 */ public void setRequestPayloadOnError(byte[] payload, String charset) { _requestPayload = (payload == null) ? null : new RequestPayload(payload, charset); }