net.sf.jmatchparser.util.split
Class SplitRule

java.lang.Object
  extended by net.sf.jmatchparser.util.split.SplitRule
Direct Known Subclasses:
CountSplitRule

public abstract class SplitRule
extends Object

A rule where to split a SplitOutputStream.


Constructor Summary
SplitRule()
           
 
Method Summary
 int findSplitPos(byte data)
          Check the given byte whether the output stream has to be split after it.
abstract  int findSplitPos(byte[] data, int off, int len)
          Check the given bytes whether the output stream has to be split in between or after the given bytes.
 void update(byte data)
          Update the internal state of this split rule after one byte has been output.
abstract  void update(byte[] data, int off, int len)
          Update the internal state of this split rule after some bytes have been output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SplitRule

public SplitRule()
Method Detail

update

public abstract void update(byte[] data,
                            int off,
                            int len)
Update the internal state of this split rule after some bytes have been output.

Parameters:
data - bytes that have been output
off - start offset
len - length

findSplitPos

public abstract int findSplitPos(byte[] data,
                                 int off,
                                 int len)
Check the given bytes whether the output stream has to be split in between or after the given bytes.

Parameters:
data - bytes that should be output
off - start offset
len - length
Returns:
-1 if the given data does not have to be split at all, or the length after which the stream has to be split. This value can never be zero or greater than len.

update

public void update(byte data)
Update the internal state of this split rule after one byte has been output. The default implementation of this method calls update(byte[], int, int) with a 1-byte byte array.

Parameters:
data - byte that has been output

findSplitPos

public int findSplitPos(byte data)
Check the given byte whether the output stream has to be split after it. The default implementation of this method calls findSplitPos(byte[], int, int) with a 1-byte byte array.

Parameters:
data - byte that should be output
Returns:
-1 if the given data does not have to be split at all, or 1 if the stream has to be split after this byte.


Copyright © 2011. All Rights Reserved.