| 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; |