@Override public BytesReference bytes() { return delegate.bytes(); } }
@Override public void flush() throws IOException { delegate.flush(); }
@Override public void reset() throws IOException { delegate.reset(); }
@Override public void writeBytes(byte[] b, int offset, int length) throws IOException { delegate.writeBytes(b, offset, length); }
@Override public void writeByte(byte b) throws IOException { delegate.writeByte(b); }
@Override public void writeBytes(byte[] b, int offset, int length) throws IOException { delegate.writeBytes(b, offset, length); }
@Override public void writeByte(byte b) throws IOException { delegate.writeByte(b); }
/** * This method ensures that compression is complete and returns the underlying bytes. * * @return bytes underlying the stream * @throws IOException if an exception occurs when writing or flushing */ BytesReference materializeBytes() throws IOException { // If we are using compression the stream needs to be closed to ensure that EOS marker bytes are written. // The actual ReleasableBytesStreamOutput will not be closed yet as it is wrapped in flushOnCloseStream when // passed to the deflater stream. if (shouldCompress) { stream.close(); } return bytesStreamOutput.bytes(); }
@Override public void writeBytes(byte[] b, int offset, int length) throws IOException { delegate.writeBytes(b, offset, length); }
@Override public void flush() throws IOException { delegate.flush(); }
@Override public void writeByte(byte b) throws IOException { delegate.writeByte(b); }
@Override public void reset() throws IOException { delegate.reset(); }
/** * Convert an {@link XContentBuilder} into a BytesReference. This method closes the builder, * so no further fields may be added. */ public static BytesReference bytes(XContentBuilder xContentBuilder) { xContentBuilder.close(); OutputStream stream = xContentBuilder.getOutputStream(); if (stream instanceof ByteArrayOutputStream) { return new BytesArray(((ByteArrayOutputStream) stream).toByteArray()); } else { return ((BytesStream) stream).bytes(); } }
@Override public void writeBytes(byte[] b, int offset, int length) throws IOException { delegate.writeBytes(b, offset, length); }
@Override public void flush() throws IOException { delegate.flush(); }
@Override public void writeByte(byte b) throws IOException { delegate.writeByte(b); }
@Override public void reset() throws IOException { delegate.reset(); }
return new BytesRestResponse(RestStatus.OK, BytesRestResponse.TEXT_CONTENT_TYPE, bytesOut.bytes());
@Override public void flush() throws IOException { delegate.flush(); }
@Override public void reset() throws IOException { delegate.reset(); }