net.siefkes.nlstego.textgen
Class StegoCoder

java.lang.Object
  extended by net.siefkes.nlstego.textgen.StegoCoder
Direct Known Subclasses:
StegoDecoder, StegoEncoder

public class StegoCoder
extends Object

Base class that contains common code shared by the StegoEncoder and StegoDecoder classes.

Instances of this class are not stateless and must be synchronized externally, if required.

Version:
$Revision: 1.12 $, $Date: 2005/07/28 15:03:12 $, $Author: siefkes $
Author:
Christian Siefkes

Constructor Summary
StegoCoder(Configuration conf, TextModel model)
          Creates a new instance.
 
Method Summary
protected  void debugBits(int num0, boolean added1, int predIndex, int predCount, String token)
          Adds a debug statement that allows tracing the encoding/decoding of bits.
protected  void debugSingleton(String token)
          Adds a debug statement that allows tracing the occurrence of single-element prediction lists.
protected  List<PredictedToken> filterFirst(List<PredictedToken> predictions)
          This method is called during encoding and decoding to filter unsuitable predictions for the very first token in a stego text.
protected  TextModel getTextModel()
          Returns the text model used by this instance.
protected  void resetState()
          Resets the state of this instance, to start encoding/decoding a new text sequence.
 String toString()
          Returns a string representation of this object.
protected  void updateState(String token)
          Updates the state of a text model after choosing a token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StegoCoder

public StegoCoder(Configuration conf,
                  TextModel model)
Creates a new instance.

Parameters:
conf - the configuration to use
model - the text model to use
Method Detail

debugBits

protected void debugBits(int num0,
                         boolean added1,
                         int predIndex,
                         int predCount,
                         String token)
Adds a debug statement that allows tracing the encoding/decoding of bits. This method should only be called if debugging is enabled for NLStego.LOG.

Parameters:
num0 - the number of '0' bits
added1 - whether a '1' bit followed
predIndex - the index of the current prediction
predCount - the number of active predictions
token - the predicted token

debugSingleton

protected void debugSingleton(String token)
Adds a debug statement that allows tracing the occurrence of single-element prediction lists. This method should only be called if debugging is enabled for NLStego.LOG.

Parameters:
token - the predicted token

filterFirst

protected List<PredictedToken> filterFirst(List<PredictedToken> predictions)
This method is called during encoding and decoding to filter unsuitable predictions for the very first token in a stego text. It discards any predicted tokens not starting with whitespace to avoid confusion between tokens with and without initial whitespace.

Parameters:
predictions - the original list of likely predictions
Returns:
a filters list of predictions suitable for the very first token

getTextModel

protected TextModel getTextModel()
Returns the text model used by this instance.

Returns:
the value of the attribute

resetState

protected void resetState()
Resets the state of this instance, to start encoding/decoding a new text sequence.


updateState

protected void updateState(String token)
Updates the state of a text model after choosing a token.

Parameters:
token - the chosen token

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object
Returns:
a textual representation


Copyright © 2003-2005 Christian Siefkes. All Rights Reserved.