Read byte from buffered Stream in Java
Description
The following code shows how to read byte from buffered Stream.
Example
// w ww . j a v a 2 s .c om
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
public class Main {
public static void main(String[] args) throws Exception {
DataInputStream in3 = new DataInputStream(new ByteArrayInputStream(
"a dbcde".getBytes()));
System.out.print((char) in3.readByte());
in3.close();
}
}
The code above generates the following result.