In order to get the fastest transfer speeds over TCP in Java, which is better:
Option A:
InputStream in = socket.getInputStream();
OutputStream out =
I don't know where you read all that nonsense but it is completely back to front. The more you write at a time to a TCP connection the better, and the more you read from it at a time ditto. I would always use a buffered stream, reader, or writer between the application and the socket streams. There are some cases like SSL where directly writing a byte at a time can cause a 40x data explosion.
Is it a good idea to touch the TCP window size? For example by setting it to 64 KiB
You can't 'touch the TCP window size'. You can increase its maximum value via the APIs you mention, and that is indeed a good idea.