List of utility methods to do ByteBuffer from Object
ByteBuffer | objectToByteBuffer(Object object) object To Byte Buffer ByteBuffer byteBuf = null;
byteBuf = ByteBuffer.wrap(serializer(object));
byteBuf.rewind();
return byteBuf;
|
ByteBuffer | objectToByteBuffer(Object target) object To Byte Buffer return ByteBuffer.wrap(objectToByte(target));
|
ByteBuffer | toByteBuffer(Object val) to Byte Buffer ByteBuffer buffer = null; try { if (val instanceof Byte) { buffer = ByteBuffer.allocate(Byte.SIZE); buffer.put(0, (Byte) val); return buffer; if (val instanceof byte[]) ... |
ByteBuffer | toByteBuffer(Serializable serializable) to Byte Buffer try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); new ObjectOutputStream(outputStream).writeObject(serializable); return ByteBuffer.wrap(outputStream.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); |