Java ByteBuffer Write writeLong(ByteBuffer logBuf, long l)

Here you can find the source of writeLong(ByteBuffer logBuf, long l)

Description

Write a long into the log.

License

Open Source License

Declaration

public static void writeLong(ByteBuffer logBuf, long l) 

Method Source Code


//package com.java2s;
/*-//from w  ww . jav a  2  s . c o  m
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2002-2010 Oracle.  All rights reserved.
 *
 */

import java.nio.ByteBuffer;

public class Main {
    /**
     * Write a long into the log.
     */
    public static void writeLong(ByteBuffer logBuf, long l) {
        byte b = (byte) (l >>> 0);
        logBuf.put(b);
        b = (byte) (l >>> 8);
        logBuf.put(b);
        b = (byte) (l >>> 16);
        logBuf.put(b);
        b = (byte) (l >>> 24);
        logBuf.put(b);
        b = (byte) (l >>> 32);
        logBuf.put(b);
        b = (byte) (l >>> 40);
        logBuf.put(b);
        b = (byte) (l >>> 48);
        logBuf.put(b);
        b = (byte) (l >>> 56);
        logBuf.put(b);
    }
}

Related

  1. writeInts4(final ByteBuffer bb, final int... values)
  2. writeL(ByteBuffer to, ByteBuffer from, int count)
  3. writeLen(int len, ByteBuffer dest, int dOff)
  4. writeLength(ByteBuffer buffer, long l)
  5. writeLong(ByteBuffer buf, long value, int len)
  6. writeLong(long num, ByteBuffer out)
  7. writeLong(long v, ByteBuffer buffer)
  8. writeLTriad(int triad, ByteBuffer bb)
  9. writeNullTerminatedString(ByteBuffer buf, String s, String encoding)