Search code examples
javasocketschecksum

Is the Java Socket BufferedReader required check sum to check the data?


I would like to use the BufferedReader to read a serialized java object, is this reliable? or I need to implement to check sum to ensure the data? Thanks.


Solution

  • You cannot use BufferedReader to read a serialized object. Java has two kinds of I/O interfaces and classes:

    • Streams (InputStream and OutputStream and everything that implements those) for reading and writing binary data.
    • Readers and writers (Reader and Writer) for reading and writing text (binary data interpreted as characters).

    Since serialized objects are binary data and not text, you cannot use a Reader to read serialized objects.