Package org.jastacry.layer
Class AbstractBasicLayer
- java.lang.Object
-
- org.jastacry.layer.AbstractBasicLayer
-
- All Implemented Interfaces:
java.lang.Runnable,Layer
- Direct Known Subclasses:
AbstractCipherLayer,AsciiTransportLayer,FilemergeLayer,RandomLayer,ReadWriteLayer,ReverseLayer,RotateLayer,TransparentLayer,XorLayer
public abstract class AbstractBasicLayer extends java.lang.Object implements java.lang.Runnable, Layer
Abstract base class for the actual worker layers.SPDX-License-Identifier: MIT
- Author:
- Kai Kretschmann
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.CountDownLatchendControllerCountdown for managing threads running.protected java.io.InputStreaminputStreamInput stream.protected org.apache.logging.log4j.LoggerloggerLogger object.protected java.io.OutputStreamoutputStreamOutput stream.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBasicLayer(java.lang.Class<?> caller, java.lang.String layerName)Constructor of Layer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intrangeCheck(int iInput)Private range check function for byte values.voidrun()Thread entry function for layer work.voidsetAction(GlobalData.Action newAction)Property setter for action.voidsetEndController(java.util.concurrent.CountDownLatch newEndController)Property setter for endcontroller.voidsetInputStream(java.io.InputStream newInputStream)Property setter for input stream.voidsetOutputStream(java.io.OutputStream newOutputStream)property setter for output stream.voidsetRealLayerName(java.lang.String newRealLayerName)Property setter for realLayerName.java.lang.StringtoString()Show a human readable name of the layer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jastacry.layer.Layer
decStream, encodeAndDecode, encStream, init
-
-
-
-
Field Detail
-
inputStream
protected java.io.InputStream inputStream
Input stream.
-
outputStream
protected java.io.OutputStream outputStream
Output stream.
-
logger
protected final org.apache.logging.log4j.Logger logger
Logger object.
-
endController
protected java.util.concurrent.CountDownLatch endController
Countdown for managing threads running.
-
-
Method Detail
-
toString
public final java.lang.String toString()
Show a human readable name of the layer.- Overrides:
toStringin classjava.lang.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(java.io.InputStream newInputStream)
Description copied from interface:LayerProperty setter for input stream.- Specified by:
setInputStreamin interfaceLayer- Parameters:
newInputStream- the new stream
-
setOutputStream
public final void setOutputStream(java.io.OutputStream newOutputStream)
Description copied from interface:Layerproperty setter for output stream.- Specified by:
setOutputStreamin interfaceLayer- Parameters:
newOutputStream- the new output stream
-
setAction
public final void setAction(GlobalData.Action newAction)
Description copied from interface:LayerProperty setter for action.
-
setEndController
public final void setEndController(java.util.concurrent.CountDownLatch newEndController)
Property setter for endcontroller.- Parameters:
newEndController- the new endcontroller
-
setRealLayerName
public final void setRealLayerName(java.lang.String newRealLayerName)
Description copied from interface:LayerProperty setter for realLayerName.- Specified by:
setRealLayerNamein interfaceLayer- Parameters:
newRealLayerName- the new layer name
-
run
public void run()
Thread entry function for layer work.- Specified by:
runin interfacejava.lang.Runnable
-
-