Java ByteBuffer Write writeBE(ByteBuffer bb, int elementWidth, long value)

Here you can find the source of writeBE(ByteBuffer bb, int elementWidth, long value)

Description

write BE

License

Open Source License

Declaration

private static void writeBE(ByteBuffer bb, int elementWidth, long value) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    private static void writeBE(ByteBuffer bb, int elementWidth, long value) {
        final int p = bb.position();
        for (int j = 0; j < elementWidth; j++) {
            bb.put(p + j, (byte) value);
            value >>>= 8;/*w  w  w.  j a  v a  2 s .  com*/
        }
        bb.position(p + elementWidth);
    }
}

Related

  1. write(WritableByteChannel socketChannel, SSLEngine engine, ByteBuffer plainOut, ByteBuffer cypherOut)
  2. writeAll(ByteBuffer buf, WritableByteChannel channel)
  3. writeAll(ByteChannel channel, ByteBuffer buffer)
  4. writeAll(GatheringByteChannel ch, ByteBuffer... bbs)
  5. writeAllToChannel(List buffers, WritableByteChannel channel)
  6. writeBER32(ByteBuffer buffer, int value)
  7. writeBigInteger(ByteBuffer bb, BigInteger bigInteger, int length)
  8. writeBlock(String fileName, long startOffset, ByteBuffer buffer, Logger log)
  9. writeBooleanArray(boolean[] array, ByteBuffer out)