net.sf.jmatchparser.util.split
Class CountSplitRule

java.lang.Object
  extended by net.sf.jmatchparser.util.split.SplitRule
      extended by net.sf.jmatchparser.util.split.CountSplitRule

public class CountSplitRule
extends SplitRule

A split rule that creates a new output file every given number of bytes or lines.


Constructor Summary
CountSplitRule(int desiredSize, boolean lines)
          Create a new rule that splits after a given number of bytes or lines.
CountSplitRule(int desiredSize, char charToCount)
          Create a new rule that splits after a given number a give character.
 
Method Summary
 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, int off, int len)
          Update the internal state of this split rule after some bytes have been output.
 
Methods inherited from class net.sf.jmatchparser.util.split.SplitRule
findSplitPos, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountSplitRule

public CountSplitRule(int desiredSize,
                      boolean lines)
Create a new rule that splits after a given number of bytes or lines.

Parameters:
desiredSize - Number of bytes/lines
lines - true for lines, false for bytes

CountSplitRule

public CountSplitRule(int desiredSize,
                      char charToCount)
Create a new rule that splits after a given number a give character.

Parameters:
desiredSize - Number of bytes/lines
charToCount - character that should be counted, or 0 to count all characters
Method Detail

findSplitPos

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

Specified by:
findSplitPos in class SplitRule
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,
                   int off,
                   int len)
Description copied from class: SplitRule
Update the internal state of this split rule after some bytes have been output.

Specified by:
update in class SplitRule
Parameters:
data - bytes that have been output
off - start offset
len - length


Copyright © 2011. All Rights Reserved.