Well, you could wrap InputStream with either BufferedInputStream (and use BufferedInputStream.read(byte[] b, int off, int len)) or wrap InputStream with a DataInputStream (and use either DataInputStream.read(byte[] b) or DataInputStream.read(byte[] b, int off, int len))
In either case above, if the data you were reading were larger than your byte[] array, you'd have to allocate a bigger one and use System.arrayCopy to move the data from the old buffer to the new. When you say the InputStream is large, how large is that? Are you going to store it as a value in an HBase column? --- Jim Kellerman, Powerset (Live Search, Microsoft Corporation) > -----Original Message----- > From: trongtran asnet [mailto:[email protected]] > Sent: Tuesday, January 13, 2009 1:31 AM > To: [email protected] > Subject: How can I convert from InputStream to Byte[] > > Dear all, > > The curent, I can convert from InputStream to byte[] by: Convert > InputStream -> String -> byte[] > This suluction is not good, because data InputStream is large. Have you > ever convert it? please help me
