java.lang.Object |
↳ |
com.facebook.common.util.StreamUtil |
Class Overview
Utility method for dealing with Streams.
Summary
Public Methods |
static
byte[]
|
getBytesFromStream(InputStream inputStream, int hint)
Efficiently fetch the bytes from the InputStream, provided that caller can guess exact numbers
of bytes that can be read from inputStream.
|
static
byte[]
|
getBytesFromStream(InputStream is)
Efficiently fetch bytes from InputStream is by delegating to getBytesFromStream(is,
is.available())
|
static
long
|
skip(InputStream inputStream, long bytesCount)
Skips exactly bytesCount bytes in inputStream unless end of stream is reached first.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public Constructors
Public Methods
public
static
byte[]
getBytesFromStream
(InputStream inputStream, int hint)
Efficiently fetch the bytes from the InputStream, provided that caller can guess exact numbers
of bytes that can be read from inputStream. Avoids one extra byte[] allocation that
ByteStreams.toByteArray() performs.
Parameters
hint |
- size of inputStream's content in bytes
|
public
static
byte[]
getBytesFromStream
(InputStream is)
Efficiently fetch bytes from InputStream is by delegating to getBytesFromStream(is,
is.available())
public
static
long
skip
(InputStream inputStream, long bytesCount)
Skips exactly bytesCount bytes in inputStream unless end of stream is reached first.
Parameters
inputStream |
input stream to skip bytes from |
bytesCount |
number of bytes to skip |