USRE-78 add zip process function
This commit is contained in:
parent
61b824d657
commit
360faf2aa0
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ThriftCompiler">
|
||||
<compilers />
|
||||
</component>
|
||||
</project>
|
|
@ -29,7 +29,7 @@ public class RetsMetadataTest extends RetsTestCase {
|
|||
|
||||
session = SessionUtils.retsLogin(retsConfigurator);
|
||||
|
||||
MSystem system = session.getMetadata().getSystem();
|
||||
MSystem system = session.getMetadata("C:\\WorkDir\\metaData.xml").getSystem();
|
||||
System.out.println(
|
||||
"SYSTEM: " + system.getSystemID() +
|
||||
" - " + system.getSystemDescription());
|
||||
|
|
|
@ -36,11 +36,25 @@
|
|||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- APACHE COMMONS -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.11.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
<version>2.7.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.ossez.usreio.common.util;
|
||||
|
||||
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
|
||||
import org.apache.commons.compress.compressors.gzip.GzipUtils;
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* SessionUtils for RETS server session
|
||||
*
|
||||
* @author YuCheng Hu
|
||||
*/
|
||||
public final class ZIPUtils {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ZIPUtils.class);
|
||||
|
||||
/**
|
||||
* @param input
|
||||
* @param output
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void compressGZIP(File input, File output) throws IOException {
|
||||
try (GzipCompressorOutputStream out = new GzipCompressorOutputStream(new FileOutputStream(output))) {
|
||||
IOUtils.copy(new FileInputStream(input), out);
|
||||
} catch (Exception IOException) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sourceFile
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static File compressGZIP(File sourceFile) throws IOException {
|
||||
// Check File
|
||||
if (!sourceFile.exists()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get gzipped
|
||||
File gzipFile = new File(sourceFile.getParentFile(), GzipUtils.getCompressedFilename(sourceFile.getName()));
|
||||
try (GzipCompressorOutputStream out = new GzipCompressorOutputStream(new FileOutputStream(gzipFile))) {
|
||||
IOUtils.copy(new FileInputStream(gzipFile), out);
|
||||
}
|
||||
return gzipFile;
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
package com.ossez.usreio.client;
|
||||
|
||||
public abstract class Main extends RetsHttpRequest {
|
||||
/**
|
||||
* Abstract class of subclasses where the Version of RETS is not needed (Password Request, Login Request, etc.)
|
||||
*/
|
||||
public Main() {
|
||||
super();
|
||||
}
|
||||
/**
|
||||
* Main function for Test and init file.
|
||||
* <p>
|
||||
* Please don't use it.
|
||||
*
|
||||
* @author YuCheng Hu
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
@Override
|
||||
public void setVersion(RetsVersion version) {
|
||||
//noop - I don't care about version
|
||||
}
|
||||
public Main() {
|
||||
System.out.println("MAIN");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue