Class ScanLine

  extended by
      extended by

public final class ScanLine
extends LineReader

Utility class for reading out CRLF delimited lines from a SharedInputStream.

Sample code

ScanLine scanLine = new ScanLine( sharedInputStream );
int startPosition = sharedInputStream.getCurrentPosition() - scanLine.lengthUnreadData();
sharedInputStream.setCurrentPosition( startPosition );

BlackBerry API 4.0.0

Field Summary
Fields inherited from class
BUFFER_LENGTH, _buffer, _bufferLength, _bufferOffset, _stream
Constructor Summary
ScanLine(SharedInputStream stream)
          Creates a new ScanLine instance.
Method Summary
 int searchForBoundary(byte[] boundary)
          Searches for middle and end boundaries.
Methods inherited from class
getBuffer, getBufferLength, getBufferOffset, getStream, lengthUnreadData, readLine, setBufferLength, setBufferOffset
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ScanLine(SharedInputStream stream)
Creates a new ScanLine instance.

stream - Shared input stream from which to read the lines.
BlackBerry API 4.0.0

Method Detail


public int searchForBoundary(byte[] boundary)
                      throws IOException
Searches for middle and end boundaries.

MIME uses this method to find the middle and end boundaries.

boundary - Boundary to search for.
An integer value in which the lower bit tells if this is the final boundary or not and the remaining bits provide the number of positions to move back in the stream to the front of the boundary.
IllegalArugmentException - If you provide a null boundary, or one with a length larger than 70.
IOException - If end of line reached and no boundary located.
BlackBerry API 4.0.0

Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.