Here you can find the source of writeInt(int v, OutputStream stream)
Parameter | Description |
---|---|
v | value |
stream | destination stream |
Parameter | Description |
---|---|
IOException | an exception |
public static void writeInt(int v, OutputStream stream) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**/*w w w .j a v a 2 s .com*/ * Writing int to stream * * @param v value * @param stream destination stream * @throws IOException */ public static void writeInt(int v, OutputStream stream) throws IOException { writeByte((byte) ((v >> 24) & 0xFF), stream); writeByte((byte) ((v >> 16) & 0xFF), stream); writeByte((byte) ((v >> 8) & 0xFF), stream); writeByte((byte) (v & 0xFF), stream); } /** * Writing byte to stream * * @param v value * @param stream destination stream * @throws IOException */ public static void writeByte(int v, OutputStream stream) throws IOException { stream.write(v); } /** * Writing byte to stream * * @param v value * @param stream destination stream * @throws IOException */ public static void writeByte(byte v, OutputStream stream) throws IOException { stream.write(v); } }