Java Code Examples for org.elasticsearch.common.io.stream.StreamInput#readBytes()
The following examples show how to use
org.elasticsearch.common.io.stream.StreamInput#readBytes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractInternalHDRPercentiles.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Override protected void doReadFrom(StreamInput in) throws IOException { valueFormatter = ValueFormatterStreams.readOptional(in); keys = new double[in.readInt()]; for (int i = 0; i < keys.length; ++i) { keys[i] = in.readDouble(); } long minBarForHighestToLowestValueRatio = in.readLong(); final int serializedLen = in.readVInt(); byte[] bytes = new byte[serializedLen]; in.readBytes(bytes, 0, serializedLen); ByteBuffer stateBuffer = ByteBuffer.wrap(bytes); try { state = DoubleHistogram.decodeFromCompressedByteBuffer(stateBuffer, minBarForHighestToLowestValueRatio); } catch (DataFormatException e) { throw new IOException("Failed to decode DoubleHistogram for aggregation [" + name + "]", e); } keyed = in.readBoolean(); }
Example 2
Source File: PartitionName.java From crate with Apache License 2.0 | 5 votes |
/** * Read utf8 bytes for bwc, with 0 as `null` indicator */ private static String readValueFrom(StreamInput in) throws IOException { int length = in.readVInt() - 1; if (length == -1) { return null; } if (length == 0) { return ""; } byte[] bytes = new byte[length]; in.readBytes(bytes, 0, length); char[] chars = new char[length]; int len = UnicodeUtil.UTF8toUTF16(bytes, 0, length, chars); return new String(chars, 0, len); }
Example 3
Source File: CompressedXContent.java From Elasticsearch with Apache License 2.0 | 4 votes |
public static CompressedXContent readCompressedString(StreamInput in) throws IOException { int crc32 = in.readInt(); byte[] compressed = new byte[in.readVInt()]; in.readBytes(compressed, 0, compressed.length); return new CompressedXContent(compressed, crc32); }
Example 4
Source File: CompressedXContent.java From crate with Apache License 2.0 | 4 votes |
public static CompressedXContent readCompressedString(StreamInput in) throws IOException { int crc32 = in.readInt(); byte[] compressed = new byte[in.readVInt()]; in.readBytes(compressed, 0, compressed.length); return new CompressedXContent(compressed, crc32); }