updated Buffer to use ByteBuffer