net.sourceforge.openstego
Class DataHeader

java.lang.Object
  extended bynet.sourceforge.openstego.DataHeader

public class DataHeader
extends java.lang.Object

This class holds the header data for the data that needs to be embedded in the image. First, the header data gets written inside the image, and then the actual data is written.


Field Summary
static byte[] DATA_STAMP
          Magic string at the start of the header to identify OpenStego embedded data
static byte[] HEADER_VERSION
          Header version to distinguish between various versions of data embedding.
 
Constructor Summary
DataHeader(java.io.InputStream dataInStream, OpenStegoConfig config)
          This constructor should be used when reading embedded data from an InputStream.
DataHeader(int dataLength, int channelBitsUsed, java.lang.String fileName, OpenStegoConfig config)
          This constructor should normally be used when writing the data.
 
Method Summary
static int byteToInt(int b)
          Byte to Int converter
 int getChannelBitsUsed()
          Get Method for channelBitsUsed
 int getDataLength()
          Get Method for dataLength
 java.lang.String getFileName()
          Get Method for fileName
 byte[] getHeaderData()
          This method generates the header in the form of byte array based on the parameters provided in the constructor.
 int getHeaderSize()
          Method to get size of the current header
static int getMaxHeaderSize()
          Method to get the maximum possible size of the header
 void setChannelBitsUsed(int channelBitsUsed)
          Set Method for channelBitsUsed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_STAMP

public static final byte[] DATA_STAMP
Magic string at the start of the header to identify OpenStego embedded data


HEADER_VERSION

public static final byte[] HEADER_VERSION
Header version to distinguish between various versions of data embedding. This should be changed to next version, in case the logic of embedding data is changed.

Constructor Detail

DataHeader

public DataHeader(int dataLength,
                  int channelBitsUsed,
                  java.lang.String fileName,
                  OpenStegoConfig config)
This constructor should normally be used when writing the data.

Parameters:
dataLength - Length of the data embedded in the image (excluding the header data)
channelBitsUsed - Number of bits used per color channel for embedding the data
fileName - Name of the file of data being embedded
config - OpenStegoConfig instance to hold the configuration data

DataHeader

public DataHeader(java.io.InputStream dataInStream,
                  OpenStegoConfig config)
           throws OpenStegoException
This constructor should be used when reading embedded data from an InputStream.

Parameters:
dataInStream - Data input stream containing the embedded data
config - OpenStegoConfig instance to hold the configuration data
Throws:
OpenStegoException
Method Detail

getHeaderData

public byte[] getHeaderData()
This method generates the header in the form of byte array based on the parameters provided in the constructor.

Returns:
Header data

getChannelBitsUsed

public int getChannelBitsUsed()
Get Method for channelBitsUsed

Returns:
channelBitsUsed

setChannelBitsUsed

public void setChannelBitsUsed(int channelBitsUsed)
Set Method for channelBitsUsed

Parameters:
channelBitsUsed -

getDataLength

public int getDataLength()
Get Method for dataLength

Returns:
dataLength

getFileName

public java.lang.String getFileName()
Get Method for fileName

Returns:
fileName

getHeaderSize

public int getHeaderSize()
Method to get size of the current header

Returns:
Header size

getMaxHeaderSize

public static int getMaxHeaderSize()
Method to get the maximum possible size of the header

Returns:
Maximum possible header size

byteToInt

public static int byteToInt(int b)
Byte to Int converter

Parameters:
b -
Returns: