BaltradDex
BALTRAD Data Exchange System
Loading...
Searching...
No Matches
eu.baltrad.dex.util.CompressDataUtil Class Reference

Public Member Functions

 CompressDataUtil ()
 
 CompressDataUtil (String rootFolder)
 
byte[] zip () throws RuntimeException
 
void unzip (String folder, byte[] bytes) throws RuntimeException
 
byte[] unzip (InputStream is) throws RuntimeException
 

Protected Member Functions

void listFiles (File node)
 
String getZipEntry (String file)
 
byte[] fileToByteArray (String fileName) throws RuntimeException
 

Protected Attributes

String rootFolder
 
Map< String, String > fileListing
 

Detailed Description

Data compression utility class.

Author
Maciej Szewczykowski | macie.nosp@m.j@ba.nosp@m.ltrad.nosp@m..eu
Version
1.7.0
Since
1.7.0

Constructor & Destructor Documentation

◆ CompressDataUtil() [1/2]

eu.baltrad.dex.util.CompressDataUtil.CompressDataUtil ( )
inline

Default constructor.

◆ CompressDataUtil() [2/2]

eu.baltrad.dex.util.CompressDataUtil.CompressDataUtil ( String rootFolder)
inline

Constructor.

Parameters
rootFolderRoot directory

Member Function Documentation

◆ fileToByteArray()

byte[] eu.baltrad.dex.util.CompressDataUtil.fileToByteArray ( String fileName) throws RuntimeException
inlineprotected

Read file to byte array.

Parameters
fileNameInput file name
Returns
File content as byte array
Exceptions
RuntimeException

◆ getZipEntry()

String eu.baltrad.dex.util.CompressDataUtil.getZipEntry ( String file)
inlineprotected

Get file's path relative to root directory.

Parameters
fileDirectory content
Returns
Relative file's path

◆ listFiles()

void eu.baltrad.dex.util.CompressDataUtil.listFiles ( File node)
inlineprotected

List files recursively.

Parameters
nodeDirectory tree node

◆ unzip() [1/2]

byte[] eu.baltrad.dex.util.CompressDataUtil.unzip ( InputStream is) throws RuntimeException
inline

Extract files from ZIP archive and write to output stream.

Parameters
isCompressed input stream
Returns
Uncompressed byte array
Exceptions
RuntimeException

◆ unzip() [2/2]

void eu.baltrad.dex.util.CompressDataUtil.unzip ( String folder,
byte[] bytes ) throws RuntimeException
inline

Extract files from ZIP archive and save to file.

Parameters
folderRoot folder
isCompressed input stream
Exceptions
RuntimeException

◆ zip()

byte[] eu.baltrad.dex.util.CompressDataUtil.zip ( ) throws RuntimeException
inline

Create ZIP archive.

Returns
ZIP archive as byte array
Exceptions
RuntimeException

The documentation for this class was generated from the following file: