ObjectInputStream readByte() method in Java with examples
The readByte() method of the ObjectInputStream class in Java is used to read the 8 bit (byte).
public byte readByte()
Parameters: This method does not accept any parameter.
Return Value: This method returns the 8 bit byte read
Errors and Exceptions: The function throws three exceptions which is described below:
- EOFException: The exception is thrown if the end of file is reached.
- IOException: The exception is thrown if an I/O error has occurred.
Below program illustrate the above method:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.