Package gov.usgs.earthquake.distribution
Class DeflateComparison
java.lang.Object
gov.usgs.earthquake.distribution.DeflateComparison
Deflate an input stream.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongdeflateStream(int level, InputStream in) Deflate an input stream.protected voidformatResult(long totalBytes, long transferredBytes, long elapsedTime) For calculating for properly formatting the resultsstatic voidA main method for accessing tests using custom files.voidtestByteArray(String name, byte[] content) Test different compression levels and speeds for a byte array.voidTest different compression levels and speeds for a file.longTransfer an input stream.
-
Constructor Details
-
DeflateComparison
public DeflateComparison()
-
-
Method Details
-
deflateStream
Deflate an input stream.- Parameters:
level- deflate level.in- input stream to deflate.- Returns:
- output length in bytes.
- Throws:
IOException- if IO error occurs
-
transferStream
Transfer an input stream.- Parameters:
in- input stream to transfer.- Returns:
- output length in bytes.
- Throws:
IOException- if IO error occurs
-
testFile
Test different compression levels and speeds for a file. Reads file into memory to avoid disk io overhead.- Parameters:
file- file to test.- Throws:
IllegalArgumentException- if illegal argIOException- if IO error occurs
-
testByteArray
Test different compression levels and speeds for a byte array.- Parameters:
name- given namecontent- content to test.- Throws:
IllegalArgumentException- if illegal argIOException- if IO error occurs
-
formatResult
protected void formatResult(long totalBytes, long transferredBytes, long elapsedTime) For calculating for properly formatting the results- Parameters:
totalBytes- totalBytestransferredBytes- Bytes transferredelapsedTime- total elapsed time
-
main
A main method for accessing tests using custom files.- Parameters:
args- a list of files or directorys to include in compression comparison.- Throws:
Exception- if error occurs
-