For some reason, this code is changing any '\ n' characters from the input and \ '\ n \ r 'I refer to some websites in the new output file, and still can not understand it. Anyone have an idea? Thanks a lot!
socket connection socket = sData.accept (); InputStream inputstream = connectionSocket.getInputStream (); BufferedInputStream inputBuffered stream = new BufferedInputStream (inputstream); FileOutputStream output stream = new file output stream ("/ home / greg / 1"); Byte [] buffer = new byte [1024]; Long calculation = 0; Int n = 0; While ((n = inputbased stream.rade (buffer)) gt; = 0) {outputstream.write (buffer, 0, n); Calculation + = n; } Outputstream.close (); }
The special code is not doing this. It is likely that \ r \ n
were already in the input source.
This can happen only when you are reading this by using BufferedReader # readLine () for example
which eats newlines and it is printed by PrintWriter # println ( )
, which adds to the default Newlines platform, maybe doing this on the other side? After all, a reader
/ author
should not be used for binary data. It can be corrupted to use InputStream
/ OutputStream
.
Comments
Post a Comment