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.CountDownLatch
endController
Countdown for managing threads running.protected java.io.InputStream
inputStream
Input stream.protected org.apache.logging.log4j.Logger
logger
Logger object.protected java.io.OutputStream
outputStream
Output stream.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractBasicLayer(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 int
rangeCheck(int iInput)
Private range check function for byte values.void
run()
Thread entry function for layer work.void
setAction(GlobalData.Action newAction)
Property setter for action.void
setEndController(java.util.concurrent.CountDownLatch newEndController)
Property setter for endcontroller.void
setInputStream(java.io.InputStream newInputStream)
Property setter for input stream.void
setOutputStream(java.io.OutputStream newOutputStream)
property setter for output stream.void
setRealLayerName(java.lang.String newRealLayerName)
Property setter for realLayerName.java.lang.String
toString()
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:
toString
in 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:Layer
Property setter for input stream.- Specified by:
setInputStream
in interfaceLayer
- Parameters:
newInputStream
- the new stream
-
setOutputStream
public final void setOutputStream(java.io.OutputStream newOutputStream)
Description copied from interface:Layer
property setter for output stream.- Specified by:
setOutputStream
in interfaceLayer
- Parameters:
newOutputStream
- the new output stream
-
setAction
public final void setAction(GlobalData.Action newAction)
Description copied from interface:Layer
Property 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:Layer
Property setter for realLayerName.- Specified by:
setRealLayerName
in interfaceLayer
- Parameters:
newRealLayerName
- the new layer name
-
run
public void run()
Thread entry function for layer work.- Specified by:
run
in interfacejava.lang.Runnable
-
-