at.knowcenter.wag.egov.egiz.pdf
Class SplitStrings

java.lang.Object
  extended by at.knowcenter.wag.egov.egiz.pdf.SplitStrings

public class SplitStrings
extends Object

Class that helps filling out the placeholders.

This class treats a sequence of placeholder StringInfos like a continuous data area that can be filled out regarding the boundaries.

Author:
wprinz

Field Summary
protected  int cur_pos
          The current write position within the current string.
protected  int cur_string
          The current string which is written to.
static byte FILL_BYTE
          The byte used to fill unused bytes in the placeholders.
protected  byte[] pdf
          The underlying PDF.
protected  StringInfo[] strings
          The strings to be filled out.
 
Constructor Summary
SplitStrings(byte[] pdf, List strings)
          Constructor.
 
Method Summary
 void fillRest()
          Fills all rest bytes with the fill character.
 boolean fits(byte[] data)
          Tells, if the whole data would fit into the current string.
 int getAvailable()
          Returns how many bytes are still available in the current string.
 boolean isValidLine()
          Tells, if the current line is valid.
 void newline()
          Fills the current string with the fill character and moves on to the next string.
 void write(byte[] data)
          Writes the data into the current string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILL_BYTE

public static final byte FILL_BYTE
The byte used to fill unused bytes in the placeholders.

See Also:
Constant Field Values

pdf

protected byte[] pdf
The underlying PDF.


strings

protected StringInfo[] strings
The strings to be filled out.


cur_string

protected int cur_string
The current string which is written to.


cur_pos

protected int cur_pos
The current write position within the current string.

Constructor Detail

SplitStrings

public SplitStrings(byte[] pdf,
                    List strings)
Constructor.

Parameters:
pdf - The underlying PDF.
strings - The strings to be filled out.
Method Detail

getAvailable

public int getAvailable()
Returns how many bytes are still available in the current string.

Returns:
Returns the number of bytes that are still available. (positive integer, or zero if none are available)

fits

public boolean fits(byte[] data)
Tells, if the whole data would fit into the current string.

Parameters:
data - The data to be matched for fitting
Returns:
Returns true, if the whole data fits, false otherwise.

write

public void write(byte[] data)
Writes the data into the current string.

Note that the data must fit in.

Parameters:
data - The data to be written.

newline

public void newline()
Fills the current string with the fill character and moves on to the next string.


fillRest

public void fillRest()
Fills all rest bytes with the fill character.

This should be called when everything is finished to fill all strings properly.


isValidLine

public boolean isValidLine()
Tells, if the current line is valid.

Returns:
Returns true, if this is a line that can be written to.


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.