|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.jadice.document.io.IOUtils
public class IOUtils
Field Summary | |
---|---|
static int |
COPY_CHUNK_SIZE
|
static int |
DEFAULT_BUFFER_SIZE
|
Constructor Summary | |
---|---|
IOUtils()
|
Method Summary | |
---|---|
static long |
copy(InputStream in,
OutputStream out)
|
static long |
copy(InputStream in,
OutputStream out,
int bufferSize)
|
static void |
copyAndClose(InputStream is,
OutputStream os)
Copies all data from input to output. |
static void |
copyStream(SeekableInputStream is,
ImageOutputStream os)
|
static void |
deleteAllBelow(File file)
Recursively delete everything below a given directory, but don't remove the directory itself. |
static void |
deleteRecursively(File file)
Recursively delete a file or directory. |
static void |
discardStream(InputStream is)
Copies all data from the input stream. |
static void |
drainAsynchronously(InputStream is)
Eagerly drain the given input stream. |
static void |
drainSynchronously(InputStream is)
Eagerly drain the given input stream. |
static boolean |
isTryFileCaching()
Return whether to try to cache data in local files by default. |
static void |
setTryFileCaching(boolean tryFileCaching)
Set whether to try to cache data in local files by default. |
static SeekableInputStream |
wrap(InputStream is)
Wraps the given stream into a SeekableInputStream . |
static SeekableInputStream |
wrap(InputStream inputStream,
boolean tryLocalTmpFileAccess)
Wraps the given stream into SeekableInputStream . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
public static final int COPY_CHUNK_SIZE
Constructor Detail |
---|
public IOUtils()
Method Detail |
---|
public static long copy(InputStream in, OutputStream out) throws IOException
IOException
public static long copy(InputStream in, OutputStream out, int bufferSize) throws IOException
IOException
public static void copyAndClose(InputStream is, OutputStream os) throws IOException
is
- os
-
IOException
public static void discardStream(InputStream is) throws IOException
is
-
IOException
public static void deleteRecursively(File file)
file
- public static void deleteAllBelow(File file)
file
- public static void copyStream(SeekableInputStream is, ImageOutputStream os) throws IOException
IOException
public static void drainSynchronously(InputStream is)
is
- public static void drainAsynchronously(InputStream is)
InputStream
while doing block-wise reads.
is
- public static final SeekableInputStream wrap(InputStream is) throws IOException
SeekableInputStream
. Checks the given input stream and if
necessary wraps it with an appropriate SeekableInputStream
implementation. This method
will try to buffer all data into a temporary file if possible. If additionally a BufferManager
is available on the classpath and temporary buffering is possible, the buffering of data will
be handled by the BufferManager. If temporary buffering is not possible (e.g. due to
security restrictions
), all data will be buffered in memory.
is
- the stream to wrap
SeekableInputStream
instance wrapping the original InputStream
IOException
- if an i/o error occurred
IllegalArgumentException
- if the given InputStream
is nullpublic static final SeekableInputStream wrap(InputStream inputStream, boolean tryLocalTmpFileAccess) throws IOException
SeekableInputStream
. Checks the given input stream and if
necessary wraps it with an appropriate SeekableInputStream
, which is returned. If
tryLocalTmpFileAccess
is true
, this method will try to buffer all
data into a temporary file if possible. If additionally a BufferManager is available on the
classpath and temporary buffering is possible, the buffering of data will be handled by the
BufferManager. If temporary buffering is not possible (e.g. due to security restrictions
), all data will be buffered in memory.
inputStream
- the stream to wraptryLocalTmpFileAccess
- enable/disable temporary file data buffering.
SeekableInputStream
instance wrapping the original InputStream
IOException
- if an i/o error occurred
IllegalArgumentException
- if the given InputStream
is nullpublic static void setTryFileCaching(boolean tryFileCaching)
wrap(InputStream)
.
tryFileCaching
- true
if local file caching should be tried by defaultpublic static boolean isTryFileCaching()
true
if local file caching is tried by default
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2017 levigo holding gmbh. All rights reserved. |