Java ByteBuffer Decode decodeTimeWithoutSign(byte firstByte, ByteBuffer buffer)

Here you can find the source of decodeTimeWithoutSign(byte firstByte, ByteBuffer buffer)

Description

decode Time Without Sign

License

Open Source License

Declaration

public static long decodeTimeWithoutSign(byte firstByte,
            ByteBuffer buffer) 

Method Source Code

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

import java.nio.ByteBuffer;

public class Main {
    private static final byte OB_DATETIME_LEN_MASK = 0x03;

    public static long decodeTimeWithoutSign(byte firstByte,
            ByteBuffer buffer) {//  ww  w  .j a  va 2s .co  m
        int lenMark = firstByte & OB_DATETIME_LEN_MASK;
        int len = 0;
        if (lenMark == 0) {
            len = 4;
        } else if (lenMark == 1) {
            len = 6;
        } else if (lenMark == 2) {
            len = 8;
        }
        long value = 0;
        for (int n = 0; n < len; n++) {
            value |= ((buffer.get() & 0xffl) << (n << 3));
        }
        return value;
    }
}

Related

  1. decodeNumber(byte firstByte, ByteBuffer buffer)
  2. decodeStoredBits(ByteBuffer bb)
  3. decodeStringSequence(ByteBuffer bb)
  4. decodeThrowing(Charset charset, ByteBuffer in)
  5. decodeTime(byte firstByte, ByteBuffer buffer)
  6. decodeToString(ByteBuffer shaderInfoLogBuffer, IntBuffer size)
  7. decodeUtf8(ByteBuffer bytes)
  8. decodeUTF8(ByteBuffer utf8Data)
  9. decodeUTF8(final ByteBuffer buf)