edu.mssm.crover.util
Class ChunkIterator

java.lang.Object
  |
  +--edu.mssm.crover.util.ChunkIterator

public class ChunkIterator
extends java.lang.Object

Uses MultiplePartFileIterator to split a file into chunks containing a predefined number of sections from the input file.


Constructor Summary
ChunkIterator(java.io.File fs, int numparts)
           
ChunkIterator(java.io.File fs, int numparts, java.lang.String split_prefix)
           
ChunkIterator(java.io.Reader reader, int numparts)
           
ChunkIterator(java.io.Reader reader, int numparts, java.lang.String split_prefix)
           
 
Method Summary
 java.lang.String getDefaultSplitPrefix()
           
 java.lang.String getSplitPrefix()
           
 boolean hasNext()
          Looks for a split prefix in the input file, starting either from the beginning of the file, or from the last line of the file that has been read.
static void main(java.lang.String[] args)
           
 java.lang.String next()
          Returns the next part of the file, from (and including) the split prefix, up to the next split prefix.
 void setChunkSize(int chunksize)
           
 void setSplitPrefix(java.lang.String splitPrefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkIterator

public ChunkIterator(java.io.File fs,
                     int numparts,
                     java.lang.String split_prefix)
              throws java.io.FileNotFoundException

ChunkIterator

public ChunkIterator(java.io.File fs,
                     int numparts)
              throws java.io.FileNotFoundException

ChunkIterator

public ChunkIterator(java.io.Reader reader,
                     int numparts)

ChunkIterator

public ChunkIterator(java.io.Reader reader,
                     int numparts,
                     java.lang.String split_prefix)
Method Detail

hasNext

public boolean hasNext()
                throws java.io.IOException
Looks for a split prefix in the input file, starting either from the beginning of the file, or from the last line of the file that has been read. A split prefix is a string which marks the beginning of a new part of the file.

java.io.IOException

next

public java.lang.String next()
                      throws java.io.IOException
Returns the next part of the file, from (and including) the split prefix, up to the next split prefix.

java.io.IOException

setSplitPrefix

public void setSplitPrefix(java.lang.String splitPrefix)

getSplitPrefix

public java.lang.String getSplitPrefix()

getDefaultSplitPrefix

public java.lang.String getDefaultSplitPrefix()

setChunkSize

public void setChunkSize(int chunksize)

main

public static void main(java.lang.String[] args)


Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.