Java ByteBuffer Write writeInt24(int v, ByteBuffer buffer)

Here you can find the source of writeInt24(int v, ByteBuffer buffer)

Description

write Int

License

Open Source License

Declaration

public static void writeInt24(int v, ByteBuffer buffer) throws IOException 

Method Source Code


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

import java.io.IOException;
import java.nio.ByteBuffer;

public class Main {
    public static void writeInt24(int v, ByteBuffer buffer) throws IOException {
        writeByte(v, buffer);//  w  w w  .  j  av a 2s. co m
        writeByte(v >> 8, buffer);
        writeByte(v >> 16, buffer);
    }

    public static void writeByte(byte v, ByteBuffer buffer) throws IOException {
        buffer.put(v);
    }

    public static void writeByte(int v, ByteBuffer buffer) throws IOException {
        buffer.put((byte) (v & 0xFF));
    }
}

Related

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