hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Kellerman (POWERSET)" <Jim.Keller...@microsoft.com>
Subject RE: How can I convert from InputStream to Byte[]
Date Tue, 13 Jan 2009 16:31:24 GMT
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:trongtran@asnet.com.vn]
> Sent: Tuesday, January 13, 2009 1:31 AM
> To: hbase-user@hadoop.apache.org
> 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


Mime
View raw message