MCPcopy Create free account
hub / github.com/apache/pig / writeBytes

Method writeBytes

src/org/apache/pig/data/utils/SedesHelper.java:34–47  ·  view source on GitHub ↗
(DataOutput out, byte[] buf)

Source from the content-addressed store, hash-verified

32 private static final TupleFactory mTupleFactory = TupleFactory.getInstance();
33
34 public static void writeBytes(DataOutput out, byte[] buf) throws IOException {
35 int sz = buf.length;
36 if (sz < BinInterSedes.UNSIGNED_BYTE_MAX) {
37 out.writeByte(BinInterSedes.TINYBYTEARRAY);
38 out.writeByte(sz);
39 } else if (sz < BinInterSedes.UNSIGNED_SHORT_MAX) {
40 out.writeByte(BinInterSedes.SMALLBYTEARRAY);
41 out.writeShort(sz);
42 } else {
43 out.writeByte(BinInterSedes.BYTEARRAY);
44 out.writeInt(sz);
45 }
46 out.write(buf);
47 }
48
49 public static byte[] readBytes(DataInput in, byte type) throws IOException {
50 int sz = 0;

Callers 5

writeDatumMethod · 0.95
writeMethod · 0.95
writeMethod · 0.45
processErrorMethod · 0.45
writeMethod · 0.45

Calls 1

writeMethod · 0.45

Tested by 1

writeMethod · 0.36