Java OutputStream Write Int writeInt(OutputStream os, int value)

Here you can find the source of writeInt(OutputStream os, int value)

Description

write Int

License

Open Source License

Declaration

public static void writeInt(OutputStream os, int value) 

Method Source Code


//package com.java2s;
import java.io.IOException;

import java.io.OutputStream;

public class Main {
    public static void writeInt(OutputStream os, int value) {
        byte[] buffer = new byte[4];
        buffer[0] = (byte) (value >> 24);
        buffer[1] = (byte) (value >> 16);
        buffer[2] = (byte) (value >> 8);
        buffer[3] = (byte) value;
        try {// ww  w  . j av a 2  s .  c  om
            os.write(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. writeInt(OutputStream dest, int val)
  2. writeInt(OutputStream file, int value)
  3. writeInt(OutputStream os, int n)
  4. writeInt(OutputStream os, int v)
  5. writeInt(OutputStream os, int val)
  6. writeInt(OutputStream os, int value)
  7. writeInt(OutputStream os, int value)
  8. writeInt(OutputStream os, long v)
  9. writeInt(OutputStream out, int i)