Package org.apache.aries.util.io
Class IOUtils
java.lang.Object
org.apache.aries.util.io.IOUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClose some xStream for good :)static voidA special version of close() for ZipFiles, which don't implement Closeable.static voidcopy(InputStream in, OutputStream out) Copy an InputStream to an OutputStream and close the InputStream afterwards.static voidCopy an InputStream to an OutputStream and do not close the InputStream afterwards.static booleandeleteRecursive(File root) Do rm -rfstatic OutputStreamgetOutputStream(File outputDir, String relativePath) static voidJar up all the contents of rootDir (recursively) into targetFile and add the manifeststatic booleanUnpack the zip file into the outputDirstatic voidwriteOut(File outputDir, String relativePath, InputStream content) Write the given InputStream to a file given by a root directory (outputDir) and a relative directory.static voidwriteOutAndDontCloseInputStream(File outputDir, String relativePath, InputStream content) Write the given InputStream to a file given by a root directory (outputDir) and a relative directory.static voidZip up all contents of rootDir (recursively) into targetFilestatic voidzipUp(File rootDir, OutputStream targetStream) Zip up all contents of rootDir (recursively) into targetStream
-
Constructor Details
-
IOUtils
public IOUtils()
-
-
Method Details
-
copy
Copy an InputStream to an OutputStream and close the InputStream afterwards.- Throws:
IOException
-
copyAndDoNotCloseInputStream
public static void copyAndDoNotCloseInputStream(InputStream in, OutputStream out) throws IOException Copy an InputStream to an OutputStream and do not close the InputStream afterwards.- Throws:
IOException
-
close
Close some xStream for good :) -
close
A special version of close() for ZipFiles, which don't implement Closeable.- Parameters:
file- the file to close. ZipFiles seem prone to file locking problems on Windows, so to aid diagnostics we throw, not swallow, any exceptions.- Throws:
IOException
-
getOutputStream
- Throws:
IOException
-
writeOut
public static void writeOut(File outputDir, String relativePath, InputStream content) throws IOException Write the given InputStream to a file given by a root directory (outputDir) and a relative directory. Necessary subdirectories will be created. This method will close the supplied InputStream.- Throws:
IOException
-
writeOutAndDontCloseInputStream
public static void writeOutAndDontCloseInputStream(File outputDir, String relativePath, InputStream content) throws IOException Write the given InputStream to a file given by a root directory (outputDir) and a relative directory. Necessary subdirectories will be created. This method will not close the supplied InputStream.- Throws:
IOException
-
zipUp
Zip up all contents of rootDir (recursively) into targetStream- Throws:
IOException
-
zipUp
Zip up all contents of rootDir (recursively) into targetFile- Throws:
IOException
-
jarUp
Jar up all the contents of rootDir (recursively) into targetFile and add the manifest- Throws:
IOException
-
deleteRecursive
Do rm -rf -
unpackZip
Unpack the zip file into the outputDir- Parameters:
zip-outputDir-- Returns:
- true if the zip was expanded, false if the zip was found not to be a zip
- Throws:
IOException- when there are unexpected issues handling the zip files.
-