public boolean readBoundary()
            throws MalformedStreamException {
        byte[] marker = new byte[2];
        boolean nextChunk = false;

        head += boundaryLength;
        try {
            marker[0] = readByte();
            if (marker[0] == LF) {
                // Work around IE5 Mac bug with input type=image.
                // Because the boundary delimiter, not including the trailing
                // CRLF, must not appear within any file (RFC 2046, section
                // 5.1.1), we know the missing CR is due to a buggy browser
                // rather than a file containing something similar to a
                // boundary.
                return true;
            }

            marker[1] = readByte();
            if (arrayequals(marker, STREAM_TERMINATOR, 2)) {
                nextChunk = false;
            } else if (arrayequals(marker, FIELD_SEPARATOR, 2)) {
                nextChunk = true;
            } else {
                throw new MalformedStreamException(
                        "Unexpected characters follow a boundary");
            }
        } catch (IOException e) {
            throw new MalformedStreamException("Stream ended unexpectedly");
        }
        return nextChunk;
    }
public boolean readBoundary ( ) throws MalformedStreamException { byte [ ] marker = new byte [ 2 ] ; boolean nextChunk = false ; head += boundaryLength ; try { marker [ 0 ] = readByte ( ) ; if ( marker [ 0 ] == LF ) { return true ; } marker [ 1 ] = readByte ( ) ; if ( arrayequals ( marker , STREAM_TERMINATOR , 2 ) ) { nextChunk = false ; } else if ( arrayequals ( marker , FIELD_SEPARATOR , 2 ) ) { nextChunk = true ; } else { throw new MalformedStreamException ( "Unexpected characters follow a boundary" ) ; } } catch ( IOException e ) { throw new MalformedStreamException ( "Stream ended unexpectedly" ) ; } return nextChunk ; }
Skips a <code>boundary</code> token, and checks whether more
<code>encapsulations</code> are contained in the stream.

@return <code>true</code> if there are more encapsulations in
this stream; <code>false</code> otherwise.

@throws MalformedStreamException if the stream ends unexpecetedly or
fails to follow required syntax.