OutputStream: write(byte[] b, int off, int len) : OutputStream : java.io : Java by API examples (example source code) Organized by topic

Java by API
C++
PHP
Java by API Home »  java.io   » [  OutputStream  ]   
 



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.  OutputStream: close()
2.  OutputStream: write(byte byteValue)
3.  OutputStream: write(byte[] values)
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.