Move the RDE compression to a dedicated file

Merges the compressor creation between RyDE and Ghostryde. Note that GhostRyde
will now compress with ZIP rather than the previous ZLIB. This is backwards
compatible because the decompression algorithm works with either, so files
created by the old version (with ZLIB) can still be opened by the new version,
and vice-versa.

The new file - RydeCompression.java - is a merge of the removed functions in Ghostryde.java and the RydePgpCompressionOutputStream.java.

This is one of a series of CLs - each merging a single "part" of the encoding.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205102150
This commit is contained in:
guyben 2018-07-18 10:51:08 -07:00 committed by jianglai
parent 9a65887789
commit 260a6fb23b
5 changed files with 132 additions and 105 deletions

View file

@ -15,6 +15,7 @@
package google.registry.rde;
import static com.google.common.base.Preconditions.checkNotNull;
import static google.registry.rde.RydeCompression.openCompressor;
import com.google.common.collect.ImmutableList;
import com.google.common.io.Closer;
@ -69,7 +70,7 @@ public final class RydeEncoder extends FilterOutputStream {
this.sigOutput = sigOutput;
signer = closer.register(new RydePgpSigningOutputStream(checkNotNull(rydeOutput), signingKey));
encryptLayer = closer.register(new RydePgpEncryptionOutputStream(signer, receiverKeys));
kompressor = closer.register(new RydePgpCompressionOutputStream(encryptLayer));
kompressor = closer.register(openCompressor(encryptLayer));
fileLayer =
closer.register(new RydePgpFileOutputStream(kompressor, modified, filenamePrefix + ".tar"));
tarLayer =