I have a piece of code that writes to a file using a DataOutputStream
wrapped around a FileOutputStream
, and writes to a string using a DataOutputStream
wrapped around a ByteArrayOutputStream
, both using the writeDouble()
method.
I then try to read from the file and compare what is read from the file, to the string,(BufferedReader
wrapped around a StringReader wrapped around b(ByteArrayOutputStream).toString(), and BufferedReader
wrapped around a FileReader
) and get the same result.
Even though
System.out.println(StrRead1.toString())
and
System.out.println(StrRead2.toString())
print the same thing in the terminal, when I compare the two using
(StrRead1.toString().equals(StrRead2.toString()))
they are never equal.(Str1 and Str2 being StringBuilder
s)
Can somebody give me a hand? Thanks.