OutputStream: write(byte[] b, int off, int len) : OutputStream « java.io « Java by API






OutputStream: write(byte[] b, int off, int len)

  
/*
 * Output:
 * 
 * 
 * 
 *  
 */

import java.io.*;

public class MainClass {

  
  public static void main(String args[]) throws Exception {
    byte buf[] = new byte[]{66,67,68,69};
    OutputStream f0 = new FileOutputStream("file1.txt");
    OutputStream f1 = new FileOutputStream("file2.txt");
    OutputStream f2 = new FileOutputStream("file3.txt");
    for (int i = 0; i < buf.length; i++) {
      f0.write(buf[i]);
    }
    f0.close();
    f1.write(buf);
    f1.close();
    f2.write(buf, buf.length / 4, buf.length / 2);
    f2.close();
  }
}
           
         
    
  








Related examples in the same category

1.extends OutputStream
2.OutputStream: close()
3.OutputStream: flush()
4.OutputStream: write(byte byteValue)
5.OutputStream: write(byte[] values)