Java ByteBuffer Write writeLong(ByteBuffer buf, long value, int len)

Here you can find the source of writeLong(ByteBuffer buf, long value, int len)

Description

write Long

License

Open Source License

Declaration

public static void writeLong(ByteBuffer buf, long value, int len) 

Method Source Code

//package com.java2s;
/**/*w w  w. jav  a  2  s  .  c  o m*/
 * Project: ${puma-common.aid}
 * <p/>
 * File Created at 2012-6-6 $Id$
 * <p/>
 * Copyright 2010 dianping.com. All rights reserved.
 * <p/>
 * This software is the confidential and proprietary information of Dianping
 * Company. ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with dianping.com.
 */

import java.nio.ByteBuffer;

public class Main {
    public static void writeLong(ByteBuffer buf, long value, int len) {
        for (int i = 0; i < len; i++) {
            buf.put((byte) ((value >>> (i << 3)) & 0xff));
        }
    }
}

Related

  1. writeIntArray(ByteBuffer buf, int[] arr)
  2. writeInts4(final ByteBuffer bb, final int... values)
  3. writeL(ByteBuffer to, ByteBuffer from, int count)
  4. writeLen(int len, ByteBuffer dest, int dOff)
  5. writeLength(ByteBuffer buffer, long l)
  6. writeLong(ByteBuffer logBuf, long l)
  7. writeLong(long num, ByteBuffer out)
  8. writeLong(long v, ByteBuffer buffer)
  9. writeLTriad(int triad, ByteBuffer bb)