public class CompressionUtils extends Object
| Constructor and Description |
|---|
CompressionUtils() |
| Modifier and Type | Method and Description |
|---|---|
void |
byteArrayToPath(File location,
byte[] compressedData) |
void |
byteArrayToZip(File location,
byte[] bytesArray) |
static String |
cleanFilename(String filename) |
void |
deleteDirectory(File path) |
void |
extractReportTemplateFromPath(File inputTemplate,
String outputFile) |
void |
extractReportTemplateToFile(String inputTemplate,
String outputFile) |
void |
extractResources(String sources,
String dest) |
void |
substituteInFile(String filename,
String marker,
StringBuilder sb)
take a StringBuilder and replace a marker inside a file by the content of that StringBuilder.
|
byte[] |
zipAsByteArray(File dirToBeCompressed) |
public static final String CRLF
public byte[] zipAsByteArray(File dirToBeCompressed) throws IOException
IOExceptionpublic void byteArrayToPath(File location, byte[] compressedData) throws Exception
Exceptionpublic void byteArrayToZip(File location, byte[] bytesArray) throws Exception
Exceptionpublic void extractResources(String sources, String dest) throws IOException, URISyntaxException
IOExceptionURISyntaxExceptionpublic void extractReportTemplateToFile(String inputTemplate, String outputFile) throws IOException, URISyntaxException
IOExceptionURISyntaxExceptionpublic void extractReportTemplateFromPath(File inputTemplate, String outputFile) throws IOException
IOExceptionpublic void deleteDirectory(File path)
public void substituteInFile(String filename, String marker, StringBuilder sb) throws IOException
filename - path of the file to changemarker - marker String in file to be replacesb - StringBuilder that has the content to put instead of the markerIOException - in case of IO file issueCopyright © 2023. All rights reserved.