Class CoderBase

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Class<?>[] acceptableOptions  
      private static byte[] NONE  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected CoderBase​(java.lang.Class<?>... acceptableOptions)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) boolean canAcceptOptions​(java.lang.Object opts)  
      (package private) abstract java.io.InputStream decode​(java.lang.String archiveName, java.io.InputStream in, long uncomressedLength, Coder coder, byte[] password, int maxMemoryLimitInKb)  
      (package private) java.io.OutputStream encode​(java.io.OutputStream out, java.lang.Object options)  
      (package private) byte[] getOptionsAsProperties​(java.lang.Object options)  
      (package private) java.lang.Object getOptionsFromCoder​(Coder coder, java.io.InputStream in)  
      protected static int numberOptionOrDefault​(java.lang.Object options, int defaultValue)
      If the option represents a number, return its integer value, otherwise return the given default value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • acceptableOptions

        private final java.lang.Class<?>[] acceptableOptions
      • NONE

        private static final byte[] NONE
    • Constructor Detail

      • CoderBase

        protected CoderBase​(java.lang.Class<?>... acceptableOptions)
        Parameters:
        acceptableOptions - types that can be used as options for this codec.
    • Method Detail

      • canAcceptOptions

        boolean canAcceptOptions​(java.lang.Object opts)
        Returns:
        whether this method can extract options from the given object.
      • getOptionsAsProperties

        byte[] getOptionsAsProperties​(java.lang.Object options)
                               throws java.io.IOException
        Returns:
        property-bytes to write in a Folder block
        Throws:
        java.io.IOException
      • getOptionsFromCoder

        java.lang.Object getOptionsFromCoder​(Coder coder,
                                             java.io.InputStream in)
                                      throws java.io.IOException
        Returns:
        configuration options that have been used to create the given InputStream from the given Coder
        Throws:
        java.io.IOException
      • decode

        abstract java.io.InputStream decode​(java.lang.String archiveName,
                                            java.io.InputStream in,
                                            long uncomressedLength,
                                            Coder coder,
                                            byte[] password,
                                            int maxMemoryLimitInKb)
                                     throws java.io.IOException
        Returns:
        a stream that reads from in using the configured coder and password.
        Throws:
        java.io.IOException
      • encode

        java.io.OutputStream encode​(java.io.OutputStream out,
                                    java.lang.Object options)
                             throws java.io.IOException
        Returns:
        a stream that writes to out using the given configuration.
        Throws:
        java.io.IOException
      • numberOptionOrDefault

        protected static int numberOptionOrDefault​(java.lang.Object options,
                                                   int defaultValue)
        If the option represents a number, return its integer value, otherwise return the given default value.