|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.synapse.format.syslog.InputStreamConsumer
public class InputStreamConsumer
Input stream consumer.
This is a helper class used by SyslogMessageBuilder
to parse data
from an input stream. In particular it supports look ahead and allows to
buffer and reread data from the stream.
Constructor Summary | |
---|---|
InputStreamConsumer(InputStream in)
Constructor. |
Method Summary | |
---|---|
void |
consume()
Consume the last byte read from the stream and advance to the next byte. |
void |
consume(int expected)
Check the value of the next byte in the stream and consume it. |
void |
expect(int expected)
Check the value of the next byte in the stream. |
int |
getInteger(int maxDigits)
Read a decimal representation of an integer from the stream. |
int |
getPosition()
Get the current position in the stream. |
int |
next()
Get the next byte from the stream without consuming it. |
void |
setPosition(int position)
Reset the stream position to a previous value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InputStreamConsumer(InputStream in)
in
- the input stream to consume data fromMethod Detail |
---|
public int next() throws IOException
IOException
- if an I/O error occurred while reading from
the streampublic void consume()
public int getPosition()
public void setPosition(int position)
position
- the new positionpublic void expect(int expected) throws IOException, ProtocolException
expected
- the expected value
IOException
- if an I/O error occurred while reading from
the stream
ProtocolException
- if the next byte doesn't have the expected valuepublic void consume(int expected) throws IOException, ProtocolException
expect(int)
with a
call to consume()
.
expected
- the expected value
IOException
- if an I/O error occurred while reading from
the stream
ProtocolException
- if the next byte doesn't have the expected valuepublic int getInteger(int maxDigits) throws IOException, ProtocolException
maxDigits
- the maximum number of expected digits
IOException
- if an I/O error occurred while reading from
the stream
ProtocolException
- if no integer value was found or if it
was too long
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |