Author and all-around good cowpoke
Posts: 13078
posted 21 years ago
Although the method you are using is safe and simple, the prefered method is to use a BufferedInputStream / BufferedOutputStream or one of the related classes for reader and writer.
You can use the available() method of BufferedInputStream to see how many bytes you can safely read into a byte[]
Whether it is worth the trouble to use a different method would depend on how often you have to do this and how much data is transferred.
Bill