MCPcopy Create free account
hub / github.com/apache/orc / writeHeader

Method writeHeader

java/core/src/java/org/apache/orc/impl/OutStream.java:183–190  ·  view source on GitHub ↗

Write the length of the compressed bytes. Life is much easier if the header is constant length, so just use 3 bytes. Considering most of the codecs want between 32k (snappy) and 256k (lzo, zlib), 3 bytes should be plenty. We also use the low bit for whether it is the original or compressed bytes. @p

(ByteBuffer buffer,
                                  int position,
                                  int val,
                                  boolean original)

Source from the content-addressed store, hash-verified

181 * @param original is it uncompressed
182 */
183 private static void writeHeader(ByteBuffer buffer,
184 int position,
185 int val,
186 boolean original) {
187 buffer.put(position, (byte) ((val << 1) + (original ? 1 : 0)));
188 buffer.put(position + 1, (byte) (val >> 7));
189 buffer.put(position + 2, (byte) (val >> 15));
190 }
191
192 private void getNewInputBuffer() {
193 if (codec == null) {

Callers 2

getNewInputBufferMethod · 0.95
spillMethod · 0.95

Calls 1

putMethod · 0.80

Tested by

no test coverage detected