List of utility methods to do ByteBuffer Set
byte[] | redByteArray(ByteBuffer buffer, int offset, int length) red Byte Array byte[] dst = new byte[length]; for (int i = 0; i < length; i++) { dst[i] = buffer.get(offset + i); return dst; |
byte | redInteger1(ByteBuffer buffer, int _offset) red Integer return buffer.get(_offset);
|
String | redString(ByteBuffer buffer, int offset, Charset charset) red String ByteArrayOutputStream out = new ByteArrayOutputStream(); for (int i = offset; i < buffer.limit(); i++) { if (((char) buffer.get(i)) == '\0') { break; out.write(new byte[] { buffer.get(i) }); return new String(out.toByteArray(), charset); ... |
void | releaseTemporaryDirectBuffer(ByteBuffer buf) release Temporary Direct Buffer if (buf == null) return; for (int i = 0; i < TEMP_BUF_POOL_SIZE; i++) { SoftReference<ByteBuffer> ref = (bufferPool[i].get()); if ((ref == null) || (ref.get() == null)) { bufferPool[i].set(new SoftReference<>(buf)); return; for (int i = 0; i < TEMP_BUF_POOL_SIZE; i++) { SoftReference ref = (bufferPool[i].get()); ByteBuffer inCacheBuf = (ByteBuffer) ref.get(); if ((inCacheBuf == null) || (buf.capacity() > inCacheBuf.capacity())) { bufferPool[i].set(new SoftReference<>(buf)); return; |
void | reset(int offset, ByteBuffer b) reset b.position(offset); b.mark(); |
void | resetBit(ByteBuffer in, int pos) Sets the bit in given input to zero Sets the pos bit in input to zero in.put(pos >> 3, (byte) (in.get(pos >> 3) & ~(1 << (pos % NBITS_PER_BYTE))));
|
void | set0byte(MappedByteBuffer mem, byte value) setbyte mem.put(0, value); mem.force(); |
void | set24BitInt(ByteBuffer buffer, int value) Places the given value into the given buffer as a 3 byte integer. if (buffer.order() == ByteOrder.BIG_ENDIAN) { buffer.put((byte) (value >> 16)); buffer.put((byte) ((value >>> 8) & 0xFF)); buffer.put((byte) (value & 0xFF)); } else { buffer.put((byte) (value & 0xFF)); buffer.put((byte) ((value >>> 8) & 0xFF)); buffer.put((byte) (value >> 16)); ... |
void | setBatch(ByteBuffer bb, long batchId) set Batch bb.putLong(batchPos, batchId); |
void | setByteOrder(ByteBuffer buffer) set Byte Order buffer.order(ByteOrder.LITTLE_ENDIAN); |