Byte Writer with FileOutputStream : Byte Read Write « File Input Output « Java

Byte Writer with FileOutputStream



public class ByteWriter {
  public static void main(String[] arguments) {
    int[] data = { 137, 89, 82, 181, 50, 220, 103, 20, 0, 59 };
    try {
      FileOutputStream file = new FileOutputStream("pic.dat");
      for (int i = 0; i < data.length; i++)
    } catch (IOException e) {
      System.out.println("Error - " + e.toString());


Related examples in the same category

1.Byte Reader with FileInputStream
2.Binary Dump OutputStream
3.Compare binary files
4.Reads bytes available from one InputStream and returns these bytes in a byte array.
5.Buffered copying between source(InputStream, Reader, String and byte[]) and destinations (OutputStream, Writer, String and byte[]).
6.Write and read compressed forms of numbers to DataOutput and DataInput interfaces.
7.Count the number of bytes written to the output stream.
8.Read and return the entire contents of the supplied file.
9.Convert 4 hex digits to an int, and return the number of converted bytes.
10.Get bytes from InputStream
11.Read file as bytesRead file as bytes