List of utility methods to do ByteBuffer Write
void | writeUB2(ByteBuffer buffer, int i) write UB buffer.put((byte) (i & 0xff)); buffer.put((byte) (i >>> 8)); |
void | writeUnsigned(int num, int size, ByteBuffer out) write Unsigned for (int i = 0; i < size; i++) { out.put((byte) num); num >>>= 8; |
void | writeUnsignedInt(ByteBuffer buf, long value) Marshall a long into the next 4 bytes in this buffer. buf.put((byte) (value >>> 0)); buf.put((byte) (value >>> 8)); buf.put((byte) (value >>> 16)); buf.put((byte) (value >>> 24)); |
void | writeUnsignedInt(final ByteBuffer buffer, final long value) Write the given long value as a 4 byte unsigned integer. buffer.putInt((int) (value & 0xffffffffL));
|
void | writeUnsignedVarInt(int value, ByteBuffer dest) write Unsigned Var Int while ((value & 0xFFFFFF80) != 0L) {
dest.putInt((value & 0x7F) | 0x80);
value >>>= 7;
dest.putInt(value & 0x7F);
|
void | writeUTF8StringToByteBuffer(String str, ByteBuffer bb) write UTF String To Byte Buffer Charset charset = Charset.forName("UTF-8"); CharsetEncoder encoder = charset.newEncoder(); CharBuffer in = CharBuffer.wrap(str); try { encoder.encode(in, bb, true); return; } catch (Exception e) { e.printStackTrace(); ... |
void | writeUUID(ByteBuffer buffer, UUID uuid) write UUID buffer.putLong(uuid.getMostSignificantBits()); buffer.putLong(uuid.getLeastSignificantBits()); |
void | writeV(ByteBuffer byteBuffer, List write V if (vint == null) return; byteBuffer.putInt(vint.size()); for (int i = 0; i < vint.size(); ++i) { byteBuffer.putInt(vint.get(i)); |
void | writeVarint(int value, ByteBuffer buffer) Write the given integer following the variable-length zig-zag encoding from Google Protocol Buffers into the buffer. int v = (value << 1) ^ (value >> 31); while ((v & 0xffffff80) != 0L) { byte b = (byte) ((v & 0x7f) | 0x80); buffer.put(b); v >>>= 7; buffer.put((byte) v); |
void | writeVarLong(ByteBuffer buff, long x) Write a variable size int. while ((x & ~0x7f) != 0) { buff.put((byte) (0x80 | (x & 0x7f))); x >>>= 7; buff.put((byte) x); |