Package com.logicaldoc.enterprise.storer
Class StorerEncryption
- java.lang.Object
-
- com.logicaldoc.enterprise.storer.StorerEncryption
-
public class StorerEncryption extends Object
Utility methods useful for those Storers that supports the encryption- Since:
- 7.7.1
- Author:
- Marco Meschieri - LogicalDOC
-
-
Field Summary
Fields Modifier and Type Field Description static String
ENCRYPTED_EXT
-
Constructor Summary
Constructors Constructor Description StorerEncryption()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InputStream
getStream(File file, String resource, boolean useAutoDelete)
Retrieves the stream of a resource inside a zip file.static long
getUncompressedSize(File file, String resource)
Retrieves the real size of a resource inside a zipstatic long
writeZip(File src, String resource, File dest, int compressionLevel)
Writes a resource into a zip filestatic long
writeZip(InputStream stream, String resource, File dest, int compressionLevel)
Writes the stream of a resource into a zip file
-
-
-
Field Detail
-
ENCRYPTED_EXT
public static final String ENCRYPTED_EXT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getStream
public static InputStream getStream(File file, String resource, boolean useAutoDelete) throws Exception
Retrieves the stream of a resource inside a zip file.- Parameters:
file
- The zip fileresource
- Name of the resourceuseAutoDelete
- true to return a stream that deletes the file once completely read- Returns:
- The stream
- Throws:
Exception
- error reading the file
-
getUncompressedSize
public static long getUncompressedSize(File file, String resource) throws Exception
Retrieves the real size of a resource inside a zip- Parameters:
file
- The zip fileresource
- The name of the resource- Returns:
- The uncompressed size expressed in bytes
- Throws:
Exception
- error reading the file
-
writeZip
public static long writeZip(InputStream stream, String resource, File dest, int compressionLevel) throws Exception
Writes the stream of a resource into a zip file- Parameters:
stream
- The input stream (it will be closed at the end)resource
- The name of the resource inside the zipdest
- The destination filecompressionLevel
- level of compression (between 0 and 9)- Returns:
- the uncompressed size of the resource
- Throws:
Exception
- error reading the stream
-
writeZip
public static long writeZip(File src, String resource, File dest, int compressionLevel) throws Exception
Writes a resource into a zip file- Parameters:
src
- The input fileresource
- The name of the resource inside the zipdest
- The destination filecompressionLevel
- level of compression (between 0 and 9)- Returns:
- the uncompressed size of the resource
- Throws:
Exception
- error reading the source or writing the destination
-
-