Class StreamWrappers

java.lang.Object
com.pnfsoftware.jeb.util.io.StreamWrappers

public class StreamWrappers extends Object
Convenient stream wrappers to encrypt or compress data. Currently supported: LZ4 compression, RC4 encryption.
  • Constructor Details

    • StreamWrappers

      public StreamWrappers()
  • Method Details

    • getCompressedStream

      public static FilterOutputStream getCompressedStream(OutputStream out)
      LZ4 compression.
      Parameters:
      out -
      Returns:
      an output stream performing on-write LZ4 compression
    • getUncompressedStream

      public static FilterInputStream getUncompressedStream(InputStream in)
      LZ4 compression.
      Parameters:
      in -
      Returns:
      an input stream performing on-read LZ4 decompression
    • getEncryptedStream

      public static FilterOutputStream getEncryptedStream(OutputStream out, byte[] key)
      RC4 encryption.
      Parameters:
      out -
      key -
      Returns:
      an output stream performing on-write RC4 encryption
    • getDecryptedStream

      public static FilterInputStream getDecryptedStream(InputStream in, byte[] key)
      RC4 encryption.
      Parameters:
      in -
      key -
      Returns:
      an input stream performing on-read RC4 decryption
    • getEncryptedStream

      public static FilterOutputStream getEncryptedStream(OutputStream out, String algo, byte[] key)
      User-selectable encryption.
      Parameters:
      out -
      algo -
      key -
      Returns:
      an output stream performing on-write encryption
    • getDecryptedStream

      public static FilterInputStream getDecryptedStream(InputStream in, String algo, byte[] key)
      User-selectable encryption.
      Parameters:
      in -
      algo -
      key -
      Returns:
      an input stream performing on-read decryption