Modifier and Type | Field and Description |
---|---|
static int |
EOF |
Constructor and Description |
---|
IOUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copy(File src,
File dest)
Copies a file.
|
static void |
copy(File src,
File dest,
IOProgressListener progressListener)
Copies a file.
|
static void |
copy(InputStream in,
OutputStream out)
Copies data from an
InputStream to an OutputStream . |
static void |
copy(InputStream in,
OutputStream out,
boolean close)
Copies data from an
InputStream to an OutputStream . |
static void |
copy(InputStream in,
OutputStream out,
boolean close,
IOProgressListener progressListener)
Copies data from an
InputStream to an OutputStream . |
static void |
copy(InputStream in,
OutputStream out,
IOProgressListener progressListener)
Copies data from an
InputStream to an OutputStream . |
static void |
copyFromResource(String path,
OutputStream out)
Copies data from an
InputStream to a OutputStream . |
static void |
copyFromResource(String path,
OutputStream out,
IOProgressListener progressListener)
Copies data from an
InputStream to a OutputStream . |
static long |
dirSize(ZipFile file,
String path)
Calculates the overall uncompressed size of all files included in the specified directory of
an archive.
|
static void |
extractDir(ZipFile file,
String sourcePath,
String destPath)
Extracts the contents of a directory from an archive (e.g.
|
static void |
extractDir(ZipFile file,
String sourcePath,
String destPath,
IOProgressListener progressListener)
Extracts the contents of a directory from an archive (e.g.
|
static void |
extractFile(ZipFile file,
String path,
File dest)
Extracts a file from an archive (e.g.
|
static void |
extractFile(ZipFile file,
String path,
File dest,
IOProgressListener progressListener)
Extracts a file from an archive (e.g.
|
static void |
extractFile(ZipFile file,
String path,
OutputStream out)
Extracts a file from an archive (e.g.
|
static void |
extractFile(ZipFile file,
String path,
OutputStream out,
IOProgressListener progressListener)
Extracts a file from an archive (e.g.
|
static String |
getClassDir(Class<?> c) |
static String |
getClassLocation(Class<?> c)
Returns either the path to the class file of the specified class without the package path or
the path top the archive file that contains it (e.g.
|
public static final int EOF
public IOUtils()
public static String getClassLocation(Class<?> c)
c
- the class that is contained in the returned JAR-filepublic static String getClassDir(Class<?> c)
public static void copy(InputStream in, OutputStream out) throws IOException
InputStream
to an OutputStream
.in
- the stream to read fromout
- the stream to write toIOException
- if an I/O error occurspublic static void copy(InputStream in, OutputStream out, boolean close) throws IOException
InputStream
to an OutputStream
.in
- the stream to read fromout
- the stream to write toclose
- defines whether the streams shall be closed after the input stream endedIOException
- if an I/O error occurspublic static void copy(InputStream in, OutputStream out, IOProgressListener progressListener) throws IOException
InputStream
to an OutputStream
.in
- the stream to read fromout
- the stream to write toprogressListener
- the progress listener which is informed about the ongoing progressIOException
- if an I/O error occurspublic static void copy(InputStream in, OutputStream out, boolean close, IOProgressListener progressListener) throws IOException
InputStream
to an OutputStream
.in
- the stream to read fromout
- the stream to write toclose
- defines whether the streams shall be closed after the input stream ended.progressListener
- the progress listener which is informed about the ongoing progressIOException
- if an I/O error occurspublic static void copy(File src, File dest, IOProgressListener progressListener) throws IOException
src
- the source filedest
- the destination fileprogressListener
- the progress listener which is informed about the ongoing progressIOException
- if an I/O error occurspublic static void copy(File src, File dest) throws IOException
src
- the source filedest
- the destination fileIOException
- if an I/O error occurspublic static void copyFromResource(String path, OutputStream out) throws IOException
InputStream
to a OutputStream
.path
- the path to the resourceout
- the stream to write toIOException
- if an I/O error occurspublic static void copyFromResource(String path, OutputStream out, IOProgressListener progressListener) throws IOException
InputStream
to a OutputStream
.path
- the path to the resourceout
- the stream to write toprogressListener
- the progress listener which is informed about the ongoing progressIOException
- if an I/O error occurspublic static void extractFile(ZipFile file, String path, OutputStream out, IOProgressListener progressListener) throws IOException
file
- the source archive filepath
- the path of the file to extract inside the archiveout
- the output stream to write the contents of the file toprogressListener
- the progress listener which is informed about the ongoing progressIOException
- if an I/O error occurspublic static void extractFile(ZipFile file, String path, OutputStream out) throws IOException
file
- the source archive filepath
- the path of the file to extract inside the archiveout
- the output stream to write the contents of the file toIOException
- if an I/O error occurspublic static void extractFile(ZipFile file, String path, File dest, IOProgressListener progressListener) throws IOException
file
- the source archive filepath
- the path of the file to extract inside the archivedest
- the destination fileprogressListener
- the progress listener which is informed about the ongoing progressIOException
- if an I/O error occurspublic static void extractFile(ZipFile file, String path, File dest) throws IOException
file
- the source archive filepath
- the path of the file to extract inside the archivedest
- the destination fileIOException
- if an I/O error occurspublic static void extractDir(ZipFile file, String sourcePath, String destPath, IOProgressListener progressListener) throws IOException
file
- the source archive filesourcePath
- the path of the source directory inside the archive (must not start with
a "/")destPath
- the path of the destination directory where the extracted files should be
storedprogressListener
- the progress listener which is informed about the ongoing progressIOException
- if an I/O error occurspublic static void extractDir(ZipFile file, String sourcePath, String destPath) throws IOException
file
- the source archive filesourcePath
- the path of the source directory inside the archive (must not start with
a "/")destPath
- the path of the destination directory where the extracted files should be
storedIOException
- if an I/O error occurspublic static long dirSize(ZipFile file, String path)
file
- the source archive filepath
- the path of the source directory inside the archive (must not start with
a "/")