I have to make a code to upload / download files on a remote machine. But when I upload the file the new line is not saved, as well as it automatically incorporates some binary characters. Besides, I can not save the file in my actual format, I want to save it as "filename.ser". I am using Java serial- deserialization concept.
Thanks in advance.
How are you broadcasting files? If you are using the implementation and they work on a byte-by-byte level, then you should end up with binary-equivalent output.
If you are using the implementation and, they are bytes for characters according to some character mapping, and then reverse the process when saving. If you are clearly not specifying charsets based on platform encoding (and possibly other effects) of different machines, then you can end well with a difference in the binary file.
The fact is that you mention Newline, I think that you are using reader
to send strings (and possibly you by manually adding new lines Stringes are sewing back together). If you want to consider the files as binary equivalent, then send them as a stream of bytes and archive that stream verbatim if you want them to be similar to the string in a given character set, then reader and writers Use, but clearly specify the character set. If you want them to be transmitted in a platform set to the default set (not very useful), then accept that they will not be equal to binary files. (In addition, your question does not really provide more information to solve it. It reads basically, "I used to code some code to X
, And it does not work. Where was I wrong? "Suppose your code is not listing it, but at the same time it assumes that it is not ...)
Comments
Post a Comment