I need to get the size in bytes of an InputStream without creating a File instance. Is there any way to do it using Java NIO?
A couple of additional options:
Depending on the blocking nature of the input stream, you could call available() on the stream.
If the streams are smallish, you could write them into PushbackInputStreams, count the bytes and then rewind.