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

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

Description

write Int

License

Open Source License

Declaration

public static void writeInt(OutputStream stream, int value) throws IOException 

Method Source Code


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

import java.io.IOException;

import java.io.OutputStream;

public class Main {
    private final static int MASK = 255;
    private final static int BITS_IN_BYTE = 8;

    public static void writeInt(OutputStream stream, int value) throws IOException {
        for (int i = 0; i < 4; ++i) {
            stream.write(value & MASK);
            value >>= BITS_IN_BYTE;
        }// w w w .  j av a  2  s .  co m
    }
}

Related

  1. writeInt(OutputStream out, int value)
  2. writeInt(OutputStream out, int x)
  3. writeInt(OutputStream out, int x)
  4. writeInt(OutputStream output, int value)
  5. writeInt(OutputStream outputStream, int integerToWrite)