List of utility methods to do ByteBuffer Write
void | writeByteBuffer(ByteBuffer bbuf, String filename) write Byte Buffer File file; try { String logfile = "C:\\" + filename + ".txt"; file = new File(logfile); boolean exists = file.exists(); if (!exists) { try { file = new File(logfile); ... |
int | writeByteBuffer(RandomAccessFile file, ByteBuffer buffer) Write an entire ByteBuffer into a file.return file.getChannel().write(buffer);
|
int | writeByteBuffer(WritableByteChannel channel, ByteBuffer buf, int bytesToWrite) Writes bytes from buf to the channel until at least bytesToWrite number of bytes are written. int t = bytesToWrite; while (t > 0) { t -= channel.write(buf); return bytesToWrite - t; |
void | writeBytesNoLength(ByteBuffer logBuf, byte[] b) Write a byte array into the log. logBuf.put(b); |
void | writeByteString(ByteBuffer byteBuffer, String value) write Byte String byteBuffer.putInt(value.length()); byteBuffer.put(value.getBytes()); |
void | writeCDouble(ByteBuffer buffer, double value) write C Double writeCLong(buffer, Double.doubleToLongBits(value)); |
void | writeCharacterString(ByteBuffer buf, byte[] bytes) Writes a character string into the buffer. if (bytes.length > 254) { throw new IllegalArgumentException( "The length of a character string must be between 0 and 254 octets."); buf.put((byte) bytes.length); buf.put(bytes); |
void | writeCInt(ByteBuffer buffer, int anInt) write C Int if (anInt > -127 && anInt <= 127) { buffer.put((byte) anInt); } else if (anInt >= Short.MIN_VALUE && anInt <= Short.MAX_VALUE) { buffer.put((byte) -128); buffer.putShort((short) anInt); } else { buffer.put((byte) -127); buffer.putInt(anInt); ... |
void | writeColorTable(ByteBuffer out, int numColors) write Color Table verifyRemaining(out, getColorTableLength(numColors)); for (int i = 0; i < numColors; i++) { out.put((byte) (0xFF0000 & i)); out.put((byte) (0x00FF00 & i)); out.put((byte) (0x0000FF & i)); |
void | writeDouble(ByteBuffer buffer, double d) write Double writeLong(buffer, Double.doubleToLongBits(d)); |