Java ByteBuffer Write writeInt(ByteBuffer logBuf, int i)

Here you can find the source of writeInt(ByteBuffer logBuf, int i)

Description

Write an int into the log.

License

Open Source License

Declaration

public static void writeInt(ByteBuffer logBuf, int i) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    /**
     * Write an int into the log.
     */
    public static void writeInt(ByteBuffer logBuf, int i) {
        byte b = (byte) ((i >> 0) & 0xff);
        logBuf.put(b);
        b = (byte) ((i >> 8) & 0xff);
        logBuf.put(b);
        b = (byte) ((i >> 16) & 0xff);
        logBuf.put(b);
        b = (byte) ((i >> 24) & 0xff);
        logBuf.put(b);
    }
}

Related

  1. writeHeaderAndLsd(ByteBuffer out, int width, int height, boolean hasGct, int gctSize)
  2. writeHexString(ByteBuffer buffer, String hex)
  3. writeHexString(ByteBuffer buffer, String hexStr)
  4. writeImageDescriptor(ByteBuffer out, int imageLeft, int imageTop, int imageWidth, int imageHeight, boolean hasLct, int numColors)
  5. writeInt(ByteBuffer buf, int pos, int v)
  6. writeInt24(int v, ByteBuffer buffer)
  7. writeInt4(final ByteBuffer bb, int value, int highValue, final boolean flush)
  8. writeInt8(final ByteBuffer bb, int value)
  9. writeIntArray(ByteBuffer buf, int[] arr)