• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Copying File Delete Special Character

Jochen Rittmann
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i copy a text file (XML) with fileChannel.transferTo. It works fine except that the target file has noch special characters any more.

So in my special problem it is that all 'carriage return line feed' will delete, so the target xml file is only one line.

Heres the code snippet for copying file...

private static void transfer (FileChannel fileChannel, ByteChannel byteChannel, long lengthInBytes, long chunckSizeInBytes, boolean verbose, boolean fromFile)
throws IOException {

long overallBytesTransfered = 0L;
long time = -System.currentTimeMillis ();
while (overallBytesTransfered < lengthInBytes) {

long bytesTransfered = 0L;

if (fromFile) {
bytesTransfered = fileChannel.transferTo (0, Math.min (chunckSizeInBytes, lengthInBytes - overallBytesTransfered), byteChannel);

Thank you for help,
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic