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 a OutputStream . |
static void |
copy(InputStream in,
OutputStream out,
boolean close) |
static void |
copy(InputStream in,
OutputStream out,
boolean close,
IOProgressListener progressListener)
Copies data from an
InputStream to a OutputStream . |
static void |
copy(InputStream in,
OutputStream out,
IOProgressListener progressListener) |
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 inculded 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 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 a OutputStream
.in
- the stream to read fromout
- the stream to write toIOException
public static void copy(InputStream in, OutputStream out, boolean close) throws IOException
IOException
public static void copy(InputStream in, OutputStream out, IOProgressListener progressListener) throws IOException
IOException
public static void copy(InputStream in, OutputStream out, boolean close, IOProgressListener progressListener) throws IOException
InputStream
to a 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
public 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
public static void copy(File src, File dest) throws IOException
src
- the source filedest
- the destination fileIOException
public static void copyFromResource(String path, OutputStream out) throws IOException
InputStream
to a OutputStream
.path
- the path to the resourceout
- the stream to write toIOException
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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 "/")