Java OutputStream Write Int writeInt(OutputStream out, int i)

Here you can find the source of writeInt(OutputStream out, int i)

Description

write Int

License

Open Source License

Declaration

public static void writeInt(OutputStream out, int i) throws IOException 

Method Source Code


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

import java.io.OutputStream;

public class Main {
    public static void writeInt(OutputStream out, int i) throws IOException {
        out.write(intToByteArray(i));//from w  w  w  .jav  a2 s.c om
    }

    public static byte[] intToByteArray(int x) {
        byte[] b = new byte[4];
        b[0] = (byte) (x >>> 24);
        b[1] = (byte) (x >>> 16);
        b[2] = (byte) (x >>> 8);
        b[3] = (byte) (x);
        return b;
    }
}

Related

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