Back to Fresco

StreamUtil

docs/javadoc/reference/com/facebook/common/util/StreamUtil.html

3.6.012.2 KB
Original Source

Fresco

|

|

Packages | Classes

Classes

Enums

Exceptions

Packages | Classes

Summary: Ctors | Methods | Inherited Methods | [Expand All]

public class

StreamUtil

extends Object

| java.lang.Object | | ↳ | com.facebook.common.util.StreamUtil |

Class Overview

Utility method for dealing with Streams.

Summary

Public Constructors
Public Methods
static byte[]
Efficiently fetch the bytes from the InputStream, provided that caller can guess exact numbers of bytes that can be read from inputStream.
static byte[]
Efficiently fetch bytes from InputStream is by delegating to getBytesFromStream(is, is.available())
static long
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 StreamUtil()

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 |

Throws

| IOException | |

public static byte[] getBytesFromStream(InputStream is)

Efficiently fetch bytes from InputStream is by delegating to getBytesFromStream(is, is.available())

Throws

| IOException | |

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 |

Returns
  • number of skipped bytes
Throws

| IOException | |

+Generated by Doclava. +