BufferedOutputStream.write(int b) has the following syntax.
public void write(int b) throws IOException
In the following code shows how to use BufferedOutputStream.write(int b) method.
/*w w w . ja v a 2s. c o m*/ import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; public class Main { public static void main(String[] args) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedOutputStream bos = new BufferedOutputStream(baos); int b = 87; bos.write(b); bos.flush(); byte[] bytes = baos.toByteArray(); System.out.println(bytes[0]); } }
The code above generates the following result.