0

By using java I have to read/write files with addition of header information. Like when a client wants to write one file, it will first send header information(length, fileinfo...) with DataOutputStream and then actual file content.

My file content are not required on application level. Is this possible to implement Zero Copy with same socket channel so I can transfer header info of file then file content.

How can i implement Zero Copy in this case.

Upendra
  • 87
  • 1
  • 10
  • 1
    Do you have any indication that you *need* to do this? Is this actually a performance bottleneck for you? – Jon Skeet May 30 '14 at 12:27
  • You need to use NIO to do this but, I suspect after a complex re-write of your code you won't see any performance difference as your disk and network will be your bottle neck. – Peter Lawrey May 30 '14 at 12:33
  • I have to test and get performance metrics. I don't know after implementing zero copy how much performance i will get. Most of the files are 200Bytes to 4KB in size. As I read from web : Zero Copy will help to minimize wasting extra memory and more context switches in transferring data, that's why I want to try. – Upendra May 30 '14 at 13:24

0 Answers0