/** * Writes raw bytes to the buffer without encoding. Same as calling * * {@link #writeRaw(byte[], int, int) writeRaw(rawBytes, 0, rawBytes.length)}. */ public Encoder writeRaw(byte[] rawBytes) throws IOException { return writeRaw(rawBytes, 0, rawBytes.length); }
/** * Writes raw bytes to the buffer without encoding. Same as calling * * {@link #writeRaw(byte[], int, int) writeRaw(rawBytes, 0, rawBytes.length)}. */ public Encoder writeRaw(byte[] rawBytes) throws IOException { return writeRaw(rawBytes, 0, rawBytes.length); }
private void init(Map<String, String> properties) throws IOException { // Writes the header for event file encoder.writeRaw(StreamDataFileConstants.MAGIC_HEADER_V2); Map<String, String> headers = Maps.newHashMap(properties); headers.put(StreamDataFileConstants.Property.Key.SCHEMA, StreamEventDataCodec.STREAM_DATA_SCHEMA.toString()); StreamUtils.encodeMap(headers, encoder); long headerSize = encoder.size(); encoder.writeTo(eventOutput); sync(eventOutput); position = headerSize; // Writes the header for index file encoder.writeRaw(StreamDataFileConstants.INDEX_MAGIC_HEADER_V1); // Empty properties map for now. May have properties in future version. StreamUtils.encodeMap(ImmutableMap.<String, String>of(), encoder); encoder.writeTo(indexOutput); sync(indexOutput); }