Java ByteBuffer to Long readLong(ByteBuffer logBuf)

Here you can find the source of readLong(ByteBuffer logBuf)

Description

Read a long from the log.

License

Open Source License

Declaration

public static long readLong(ByteBuffer logBuf) 

Method Source Code


//package com.java2s;
/*-/*  ww  w .j  ava 2 s .co m*/
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2002,2007 Oracle.  All rights reserved.
 *
 * $Id: LogUtils.java,v 1.50.2.1 2007/02/01 14:49:47 cwl Exp $
 */

import java.nio.ByteBuffer;

public class Main {
    /**
     * Read a long from the log.
     */
    public static long readLong(ByteBuffer logBuf) {
        long ret = (logBuf.get() & 0xFFL) << 0;
        ret += (logBuf.get() & 0xFFL) << 8;
        ret += (logBuf.get() & 0xFFL) << 16;
        ret += (logBuf.get() & 0xFFL) << 24;
        ret += (logBuf.get() & 0xFFL) << 32;
        ret += (logBuf.get() & 0xFFL) << 40;
        ret += (logBuf.get() & 0xFFL) << 48;
        ret += (logBuf.get() & 0xFFL) << 56;
        return ret;
    }
}

Related

  1. readLong(ByteBuffer buf, int length)
  2. readLong(ByteBuffer buffer)
  3. readLong(ByteBuffer buffer)
  4. readLong(ByteBuffer in)
  5. readLong(ByteBuffer in, final int fitInBytes)
  6. readLong64ls(int size, ByteBuffer byteBuf)
  7. readLongArray(ByteBuffer bb)
  8. readLongLE(ByteBuffer buf, int i)
  9. readUB1(ByteBuffer buffer)