Java PrintStream.write(byte[] buf, int off, int len)
Syntax
PrintStream.write(byte[] buf, int off, int len) has the following syntax.
public void write(byte[] buf, int off, int len)
Example
In the following code shows how to use PrintStream.write(byte[] buf, int off, int len) method.
/* ww w . j a va2 s.com*/
import java.io.*;
public class Main {
public static void main(String[] args) {
byte c[] = {70, 71, 72, 73, 74, 75, 76};
PrintStream ps = new PrintStream(System.out);
// write bytes 1-3
ps.write(c, 1, 3);
// flush the stream
ps.flush();
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »