List of utility methods to do ByteBuffer Write
int | write(WritableByteChannel out, ByteBuffer buffer) write int bytesWritten = 0; while (buffer.hasRemaining()) { bytesWritten += out.write(buffer); return bytesWritten; |
void | write(WritableByteChannel socketChannel, SSLEngine engine, ByteBuffer plainOut, ByteBuffer cypherOut) write while (plainOut.hasRemaining()) { cypherOut.clear(); SSLEngineResult result = engine.wrap(plainOut, cypherOut); switch (result.getStatus()) { case OK: cypherOut.flip(); while (cypherOut.hasRemaining()) { socketChannel.write(cypherOut); ... |
void | writeAll(ByteBuffer buf, WritableByteChannel channel) write All while (buf.remaining() > 0)
channel.write(buf);
|
void | writeAll(ByteChannel channel, ByteBuffer buffer) write All while (buffer.hasRemaining()) {
channel.write(buffer);
|
void | writeAll(GatheringByteChannel ch, ByteBuffer... bbs) write All writeAll(ch, bbs, 0, bbs.length); |
void | writeAllToChannel(List write All To Channel for (ByteBuffer buffer : buffers) {
channel.write(buffer);
|
void | writeBE(ByteBuffer bb, int elementWidth, long value) write BE final int p = bb.position(); for (int j = 0; j < elementWidth; j++) { bb.put(p + j, (byte) value); value >>>= 8; bb.position(p + elementWidth); |
void | writeBER32(ByteBuffer buffer, int value) write BER buffer.put((byte) ((value >> 21) | 0x80)); buffer.put((byte) ((value >> 14) | 0x80)); buffer.put((byte) ((value >> 7) | 0x80)); buffer.put((byte) (value & 0x7F)); |
void | writeBigInteger(ByteBuffer bb, BigInteger bigInteger, int length) write Big Integer byte[] bigInt = bigInteger.toByteArray(); int skipZeroPos = 0; for (int i = 0; i < bigInt.length; i++) { if (bigInt[i] != 0) { break; skipZeroPos++; byte[] tmp = new byte[bigInt.length - skipZeroPos]; System.arraycopy(bigInt, skipZeroPos, tmp, 0, tmp.length); bigInt = tmp; reverseBytes(bigInt); int padByteLength = length - bigInt.length; if (padByteLength > 0) { tmp = new byte[length]; System.arraycopy(bigInt, 0, tmp, 0, bigInt.length); bigInt = tmp; bb.put(bigInt); |
boolean | writeBlock(String fileName, long startOffset, ByteBuffer buffer, Logger log) Write received block to physical file on disk. RandomAccessFile randomAccessFile = null; File file = new File(fileName); if (!file.exists()) { if (log != null) log.log(Level.WARNING, "Cannot write file \"" + fileName + "\" that does not exist"); return false; if (startOffset + buffer.remaining() > file.length()) { ... |