DataInputStream readUnsignedByte() method in Java with Examples
The readUnsignedByte() method of DataInputStream class in Java is used to read byte and returns as an integer. The integer is an unsigned value in the range from 0 to 255. The bytes in this method are read from the accommodated input stream.
public final int readUnsignedByte() throws IOException
Specified By: This method is specified by readUnsignedByte() method of DataInput interface.
Parameters: This method does not accept any parameter.
Return value: This method returns the byte value read as an integer. It is an unsigned 8-bit byte.
- EOFException – It throws EOFException if the input stream is ended.
- IOException – This method throws IOException if the stream is closed or some other I/O error occurs.
Below programs illustrate readUnsignedByte() method in DataInputStream class in IO package:
10 20 30 40 50
236 246 0 10 20
My Personal Notes arrow_drop_up
Please Login to comment...