Java Utililty Methods ByteBuffer Set

List of utility methods to do ByteBuffer Set

Description

The list of methods to do ByteBuffer Set are organized into topic(s).

Method

voidsetUniqueness(ByteBuffer bb, long uniqueness)
set Uniqueness
bb.putLong(uniquenessPos, uniqueness);
voidsetUnsignedInt32(ByteBuffer buffer, int offset, long value)
set Unsigned Int
if ((value < 0) || (value > 0xffffffffL)) {
    throw new IllegalArgumentException("uint32 value of out range: " + value);
buffer.putInt(offset, (int) value);
voidsetZipEocdCentralDirectoryOffset(ByteBuffer zipEndOfCentralDirectory, long offset)
Sets the offset of the start of the ZIP Central Directory in the archive.
assertByteOrderLittleEndian(zipEndOfCentralDirectory);
setUnsignedInt32(zipEndOfCentralDirectory,
        zipEndOfCentralDirectory.position() + ZIP_EOCD_CENTRAL_DIR_OFFSET_FIELD_OFFSET, offset);
ByteBuffer[]subsequence(ByteBuffer[] bs, int offset, int length)
subsequence
if ((offset == 0) && (length == bs.length))
    return bs;
int n = length;
ByteBuffer[] bs2 = new ByteBuffer[n];
for (int i = 0; i < n; i++)
    bs2[i] = bs[offset + i];
return bs2;
intsubstringBetweenLast(final byte[] text, final int offset, final int limit, final byte[] start, final byte[] end, final boolean trim, ByteBuffer bb)
substring Between Last
int nEnd = lastIndexOf(text, offset, limit, end);
int nStart = -1;
if (nEnd > start.length) {
    nStart = lastIndexOf(text, offset, nEnd - 1, start);
    if (nStart < nEnd && nStart != -1 && nEnd != -1) {
        nStart += start.length;
        if (trim) {
            byte c;
...
voidupdateChecksum(CRC32 checksum, ByteBuffer buffer, int offset, int length)
Updates checksum with the provided ByteBuffer at the given offset + length.
int position = buffer.position();
int limit = buffer.limit();
buffer.position(offset).limit(offset + length);
checksum.update(buffer);
buffer.position(position).limit(limit);
booleanvalidBytesUTF8(ByteBuffer buf, int offset, int limit)
valid Bytes UTF
for (int index = offset; index < limit;) {
    byte leadingByte = buf.get(index++);
    if ((leadingByte & 0xc0) == 0x80) {
        return false;
    int remaining = remainingBytesUTF8(leadingByte);
    switch (remaining) {
    case 0:
...