ikrs.io
Class ByteSequenceTokenizer

java.lang.Object
  extended by ikrs.io.ByteSequenceTokenizer
Direct Known Subclasses:
MultipartMIMETokenizer

public class ByteSequenceTokenizer
extends java.lang.Object

The byte sequence tokenizer splits a given byte sequence (coming from an inputstream) into a sequence of byte-streams, all seperated by a given separator byte sequence.


Constructor Summary
ByteSequenceTokenizer(java.io.InputStream in, byte[] separator)
           
 
Method Summary
 java.io.InputStream getNextToken()
          Get the next token from the underlying input stream; the token itself is an InputStream, too.
static void main(java.lang.String[] argv)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteSequenceTokenizer

public ByteSequenceTokenizer(java.io.InputStream in,
                             byte[] separator)
                      throws java.lang.NullPointerException
Throws:
java.lang.NullPointerException
Method Detail

getNextToken

public java.io.InputStream getNextToken()
                                 throws java.io.IOException
Get the next token from the underlying input stream; the token itself is an InputStream, too. All tokens a separated by the given separator byte sequence. Note that if the last token was not fully consumed this method will dispose its data and invalidating the old token. Data cannot be read then any more using the old reference. If no more data is available from the underlying input stream this method returns null.

Returns:
The next InputStream token from the underlying input stream.
Throws:
java.io.IOException

main

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