How to find the size of a ReadableByteChannel in Java?
问题 I am converting a blob from a database into a PDF, using Java's Channel classes. When using a Channel's transferFrom( ) method, you are supposed to specify the maximum number of bytes to be transferred. How are you supposed to find this maximum number of bytes when ReadableByteChannels don't have a size( ) method like other Channels? Is a ReadableByteChannel not the right tool for the job since it doesn't have a size( ) method? I'm just using Long.MAX_VALUE which doesn't seem right. Example