Class AbstractBasicLayer

    • Field Detail

      • inputStream

        protected InputStream inputStream
        Input stream.
      • outputStream

        protected OutputStream outputStream
        Output stream.
      • logger

        protected final org.apache.logging.log4j.Logger logger
        Logger object.
      • endController

        protected CountDownLatch endController
        Countdown for managing threads running.
    • Constructor Detail

      • AbstractBasicLayer

        protected AbstractBasicLayer​(Class<?> caller,
                                     String layerName)
        Constructor of Layer.
        Parameters:
        caller - class object
        layerName - name of real layer
    • Method Detail

      • toString

        public final String toString()
        Show a human readable name of the layer.
        Overrides:
        toString in class Object
        Returns:
        a human readable name of the layer
        See Also:
        Object.toString()
      • rangeCheck

        protected final int rangeCheck​(int iInput)
        Private range check function for byte values.
        Parameters:
        iInput - as input value
        Returns:
        range checked byte value
      • setInputStream

        public final void setInputStream​(InputStream newInputStream)
        Description copied from interface: Layer
        Property setter for input stream.
        Specified by:
        setInputStream in interface Layer
        Parameters:
        newInputStream - the new stream
      • setOutputStream

        public final void setOutputStream​(OutputStream newOutputStream)
        Description copied from interface: Layer
        property setter for output stream.
        Specified by:
        setOutputStream in interface Layer
        Parameters:
        newOutputStream - the new output stream
      • setAction

        public final void setAction​(GlobalData.Action newAction)
        Description copied from interface: Layer
        Property setter for action.
        Specified by:
        setAction in interface Layer
        Parameters:
        newAction - the new action
      • setEndController

        public final void setEndController​(CountDownLatch newEndController)
        Property setter for endcontroller.
        Parameters:
        newEndController - the new endcontroller
      • progress

        protected final void progress​(long stepsize)
        Call this function for every step forward in encoding or decoding.
        Parameters:
        stepsize - number of bytes we processed in this step
      • setRealLayerName

        public final void setRealLayerName​(String newRealLayerName)
        Description copied from interface: Layer
        Property setter for realLayerName.
        Specified by:
        setRealLayerName in interface Layer
        Parameters:
        newRealLayerName - the new layer name
      • run

        public void run()
        Thread entry function for layer work.
        Specified by:
        run in interface Runnable
      • readAllBytes

        protected final int readAllBytes​(InputStream is,
                                         byte[] aTarget,
                                         int len)
                                  throws IOException
        Read all wanted bytes from inputStream.
        Parameters:
        is - the stream to read from
        aTarget - target byte array
        len - complete wanted length
        Returns:
        number of bytes read
        Throws:
        IOException - in case of error