class MessageReader extends Object
Modifier and Type | Class and Description |
---|---|
private class |
MessageReader.BoundedInputStream
Input stream for reading bounded content data.
|
private class |
MessageReader.ChunkedInputStream
Input stream for reading chunked content data.
|
Modifier and Type | Field and Description |
---|---|
private InputStream |
cin |
private static int |
CONTENT |
private static int |
DONE |
private static int |
HEADER |
private InputStream |
in |
private boolean |
noContent |
private static byte[] |
sink |
private StartLine |
sline |
private static int |
START |
private int |
state |
Constructor and Description |
---|
MessageReader(InputStream in,
boolean noContent)
Creates new reader on top of given input stream.
|
Modifier and Type | Method and Description |
---|---|
(package private) int |
availableContent()
Returns count of available message content.
|
private static boolean |
contentIndicated(StartLine sline,
Header header)
Returns true if given start line and header indicate a content body.
|
(package private) int |
readContent(byte[] b,
int off,
int len)
Reads message content.
|
(package private) Header |
readHeader()
Reads in HTTP message header.
|
(package private) static String |
readLine(InputStream in)
Reads and returns next line from stream, or null if at end of stream.
|
(package private) StartLine |
readStartLine()
Reads in HTTP message start line.
|
(package private) Header |
readTrailer()
Reads in message trailer after consuming any unread content data.
|
private void |
updateState(int oldState,
int newState) |
private static final int START
private static final int HEADER
private static final int CONTENT
private static final int DONE
private static final byte[] sink
private final InputStream in
private final boolean noContent
private int state
private StartLine sline
private InputStream cin
MessageReader(InputStream in, boolean noContent)
StartLine readStartLine() throws IOException
IOException
Header readHeader() throws IOException
IOException
int readContent(byte[] b, int off, int len) throws IOException
IOException
int availableContent() throws IOException
IOException
Header readTrailer() throws IOException
IOException
static String readLine(InputStream in) throws IOException
IOException
private void updateState(int oldState, int newState)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.