Class HTTPMessageDecoder
java.lang.Object
com.biglybt.core.networkmanager.impl.http.HTTPMessageDecoder
- All Implemented Interfaces:
MessageStreamDecoder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private boolean
private final StringBuffer
private HTTPNetworkConnection
private static final int
private final List
private static final String
private boolean
private boolean
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addMessage
(Message message) destroy()
Destroy this decoder, i.e.int[]
Get the details of the current message that is being received (read from the transport).int
Get the number of (piece) data bytes decoded from the transport, from the last decode op.int
Get the number of protocol (overhead) bytes decoded from the transport, from the last decode op.protected int
void
Pause message decoding.protected void
int
performStreamDecode
(Transport transport, int max_bytes) Decode message stream from the given transport.Message[]
Get the messages decoded from the transport, if any, from the last decode op.void
Resume message decoding.void
setConnection
(HTTPNetworkConnection _http_connection)
-
Field Details
-
MAX_HEADER
private static final int MAX_HEADER- See Also:
-
NL
- See Also:
-
http_connection
-
paused
private volatile boolean paused -
paused_internally
private volatile boolean paused_internally -
destroyed
private volatile boolean destroyed -
header_so_far
-
header_ready
private boolean header_ready -
messages
-
protocol_bytes_read
private int protocol_bytes_read
-
-
Constructor Details
-
HTTPMessageDecoder
public HTTPMessageDecoder() -
HTTPMessageDecoder
-
-
Method Details
-
setConnection
-
performStreamDecode
Description copied from interface:MessageStreamDecoder
Decode message stream from the given transport.- Specified by:
performStreamDecode
in interfaceMessageStreamDecoder
- Parameters:
transport
- to decode frommax_bytes
- to decode/read from the stream- Returns:
- number of bytes decoded
- Throws:
IOException
- on decoding error
-
addMessage
-
removeDecodedMessages
Description copied from interface:MessageStreamDecoder
Get the messages decoded from the transport, if any, from the last decode op.- Specified by:
removeDecodedMessages
in interfaceMessageStreamDecoder
- Returns:
- decoded messages, or null if no new complete messages were decoded
-
getProtocolBytesDecoded
public int getProtocolBytesDecoded()Description copied from interface:MessageStreamDecoder
Get the number of protocol (overhead) bytes decoded from the transport, from the last decode op.- Specified by:
getProtocolBytesDecoded
in interfaceMessageStreamDecoder
- Returns:
- number of protocol bytes received
-
getDataBytesDecoded
public int getDataBytesDecoded()Description copied from interface:MessageStreamDecoder
Get the number of (piece) data bytes decoded from the transport, from the last decode op.- Specified by:
getDataBytesDecoded
in interfaceMessageStreamDecoder
- Returns:
- number of data bytes received
-
getCurrentMessageProgress
public int[] getCurrentMessageProgress()Description copied from interface:MessageStreamDecoder
Get the details of the current message that is being received (read from the transport).- Specified by:
getCurrentMessageProgress
in interfaceMessageStreamDecoder
- Returns:
- [ size, done ] or null
-
pauseInternally
protected void pauseInternally() -
pauseDecoding
public void pauseDecoding()Description copied from interface:MessageStreamDecoder
Pause message decoding.- Specified by:
pauseDecoding
in interfaceMessageStreamDecoder
-
resumeDecoding
public void resumeDecoding()Description copied from interface:MessageStreamDecoder
Resume message decoding.- Specified by:
resumeDecoding
in interfaceMessageStreamDecoder
-
getQueueSize
protected int getQueueSize() -
destroy
Description copied from interface:MessageStreamDecoder
Destroy this decoder, i.e. perform cleanup.- Specified by:
destroy
in interfaceMessageStreamDecoder
- Returns:
- any bytes already-read and still remaining within the decoder
-