public class IOUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BITS_PER_BYTE
|
static long |
HEX_255_LONG
|
Constructor and Description |
---|
IOUtils()
|
Modifier and Type | Method and Description |
---|---|
static void |
closeQuietly(java.io.Closeable closeable)
Closes a Closeable object
|
static void |
closeQuietly(java.io.Closeable[] closeables)
Closes all Closeable objects from an array
|
static void |
closeQuietly(java.lang.Iterable<? extends java.io.Closeable> closeables)
Closes all Closeable objects from a Iterable
|
static void |
closeQuietly(java.net.Socket socket)
Closes a Socket object
|
static boolean |
isAndroidGetsocknameError(java.lang.AssertionError e)
Returns true if
e is due to a firmware bug fixed after Android 4.2.2. |
static long |
peekNumberLe(okio.BufferedSource source,
int byteCount)
Peeks but does not consume a number from a BufferedSource
|
static long |
peekNumberLe(okio.BufferedSource source,
int offset,
int byteCount)
Peeks but does not consume a number from a BufferedSource
|
static long |
readNumberLe(okio.BufferedSource source,
int byteCount)
Reads a number from the BufferedSource
|
static void |
skipAll(okio.Source source)
Goes through the Source and consumes all the contents
|
static boolean |
skipAll(okio.Source source,
int duration,
java.util.concurrent.TimeUnit timeUnit)
Reads until
in is exhausted or the deadline has been reached. |
public static final int BITS_PER_BYTE
public static final long HEX_255_LONG
public static void closeQuietly(java.io.Closeable[] closeables)
closeables
- an array of Closeable to be closedpublic static void closeQuietly(java.lang.Iterable<? extends java.io.Closeable> closeables)
closeables
- an Iterable of Closeable to be closedpublic static void closeQuietly(java.io.Closeable closeable)
closeable
- the Closeable object to be closedpublic static void closeQuietly(java.net.Socket socket)
socket
- the Socket to be closedpublic static boolean isAndroidGetsocknameError(java.lang.AssertionError e)
e
is due to a firmware bug fixed after Android 4.2.2.
https://code.google.com/p/android/issues/detail?id=54072e
- the suspected errorpublic static void skipAll(okio.Source source) throws java.io.IOException
source
- the Source to consume data fromjava.io.IOException
- upon failed IO operationspublic static boolean skipAll(okio.Source source, int duration, java.util.concurrent.TimeUnit timeUnit) throws java.io.IOException
in
is exhausted or the deadline has been reached. This is careful to not
extend the deadline if one exists already.source
- the target source to be exhaustedduration
- the time available for exhaustiontimeUnit
- the time unit of exhaustion timejava.io.IOException
- on an IO errorpublic static long readNumberLe(okio.BufferedSource source, int byteCount) throws java.io.IOException
source
- the data source to read frombyteCount
- the number of bytes to readjava.io.IOException
- on failed IO operationspublic static long peekNumberLe(okio.BufferedSource source, int offset, int byteCount) throws java.io.IOException
source
- the data source to peek fromoffset
- marks where should the peeking beginbyteCount
- the number of bytes to readjava.io.IOException
- on failed IO operationspublic static long peekNumberLe(okio.BufferedSource source, int byteCount) throws java.io.IOException
source
- the data source to peek frombyteCount
- the number of bytes to peekjava.io.IOException
- on an IO error