Package com.dropbox.core.util
Class IOUtil
- java.lang.Object
-
- com.dropbox.core.util.IOUtil
-
public class IOUtil extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
IOUtil.ProgressListener
static class
IOUtil.ReadException
static class
IOUtil.WrappedException
static class
IOUtil.WriteException
-
Field Summary
Fields Modifier and Type Field Description static java.io.OutputStream
BlackHoleOutputStream
static int
DEFAULT_COPY_BUFFER_SIZE
static java.io.InputStream
EmptyInputStream
-
Constructor Summary
Constructors Constructor Description IOUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
closeInput(java.io.InputStream in)
Closes the given input stream and ignores the IOException.static void
closeInput(java.io.Reader in)
Closes the given Reader and ignores the IOException.static void
closeQuietly(java.io.Closeable obj)
void
copyFileToStream(java.io.File fin, java.io.OutputStream out)
void
copyFileToStream(java.io.File fin, java.io.OutputStream out, int copyBufferSize)
void
copyStreamToFile(java.io.InputStream in, java.io.File fout)
void
copyStreamToFile(java.io.InputStream in, java.io.File fout, int copyBufferSize)
static void
copyStreamToStream(java.io.InputStream in, java.io.OutputStream out)
static void
copyStreamToStream(java.io.InputStream in, java.io.OutputStream out, byte[] copyBuffer)
static void
copyStreamToStream(java.io.InputStream in, java.io.OutputStream out, int copyBufferSize)
static java.io.InputStream
limit(java.io.InputStream in, long limit)
static byte[]
slurp(java.io.InputStream in, int byteLimit)
static byte[]
slurp(java.io.InputStream in, int byteLimit, byte[] slurpBuffer)
static java.lang.String
toUtf8String(java.io.InputStream in)
static java.io.Reader
utf8Reader(java.io.InputStream in)
static java.io.Writer
utf8Writer(java.io.OutputStream out)
-
-
-
Field Detail
-
DEFAULT_COPY_BUFFER_SIZE
public static final int DEFAULT_COPY_BUFFER_SIZE
- See Also:
- Constant Field Values
-
EmptyInputStream
public static final java.io.InputStream EmptyInputStream
-
BlackHoleOutputStream
public static final java.io.OutputStream BlackHoleOutputStream
-
-
Method Detail
-
utf8Reader
public static java.io.Reader utf8Reader(java.io.InputStream in)
-
utf8Writer
public static java.io.Writer utf8Writer(java.io.OutputStream out)
-
toUtf8String
public static java.lang.String toUtf8String(java.io.InputStream in) throws IOUtil.ReadException, java.nio.charset.CharacterCodingException
- Throws:
IOUtil.ReadException
java.nio.charset.CharacterCodingException
-
copyStreamToStream
public static void copyStreamToStream(java.io.InputStream in, java.io.OutputStream out) throws IOUtil.ReadException, IOUtil.WriteException
-
copyStreamToStream
public static void copyStreamToStream(java.io.InputStream in, java.io.OutputStream out, byte[] copyBuffer) throws IOUtil.ReadException, IOUtil.WriteException
-
copyStreamToStream
public static void copyStreamToStream(java.io.InputStream in, java.io.OutputStream out, int copyBufferSize) throws IOUtil.ReadException, IOUtil.WriteException
-
slurp
public static byte[] slurp(java.io.InputStream in, int byteLimit) throws java.io.IOException
- Throws:
java.io.IOException
-
slurp
public static byte[] slurp(java.io.InputStream in, int byteLimit, byte[] slurpBuffer) throws java.io.IOException
- Throws:
java.io.IOException
-
copyFileToStream
public void copyFileToStream(java.io.File fin, java.io.OutputStream out) throws IOUtil.ReadException, IOUtil.WriteException
-
copyFileToStream
public void copyFileToStream(java.io.File fin, java.io.OutputStream out, int copyBufferSize) throws IOUtil.ReadException, IOUtil.WriteException
-
copyStreamToFile
public void copyStreamToFile(java.io.InputStream in, java.io.File fout) throws IOUtil.ReadException, IOUtil.WriteException
-
copyStreamToFile
public void copyStreamToFile(java.io.InputStream in, java.io.File fout, int copyBufferSize) throws IOUtil.ReadException, IOUtil.WriteException
-
closeInput
public static void closeInput(java.io.InputStream in)
Closes the given input stream and ignores the IOException.
-
closeInput
public static void closeInput(java.io.Reader in)
Closes the given Reader and ignores the IOException.
-
closeQuietly
public static void closeQuietly(java.io.Closeable obj)
-
limit
public static java.io.InputStream limit(java.io.InputStream in, long limit)
-
-