public final class RawMessage
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RawMessage.State |
Modifier and Type | Field and Description |
---|---|
static byte |
COLON |
static byte |
CR |
static byte |
HTAB |
static byte |
LF |
static byte |
SP |
Constructor and Description |
---|
RawMessage(int maxAllowedInitialLineSize,
int maxAllowedHeaderSize,
int maxAllowedContentLength)
Creates a new holder for a raw SIP message.
|
Modifier and Type | Method and Description |
---|---|
int |
getContentLength()
Get the content length of this message.
|
io.pkts.buffer.Buffer |
getHeaders()
Get all the raw headers of this message
|
io.pkts.buffer.Buffer |
getInitialLine()
Get the initial line of this raw message.
|
io.pkts.buffer.Buffer |
getPayload()
Get the payload of this raw message.
|
int |
getPayloadWriteIndex()
For stream based protocols there could be another message coming directly
after this one so you just cant read until the
ChannelBuffer runs
out of bytes. |
boolean |
isComplete() |
static boolean |
isDigit(byte b) |
static boolean |
isDigit(char ch) |
boolean |
payloadCompleted()
Check whether we have read the entire payload.
|
void |
setContentLength(int contentLength)
Set the expected content length of this message.
|
java.lang.String |
toString() |
void |
write(byte b) |
void |
writeToHeaders(byte b)
Write a byte to the header section of this raw message.
|
void |
writeToInitialLine(byte b)
Write a byte to the initial line.
|
void |
writeToPayload(byte b)
Write the next byte to the payload section of this message.
|
public static final byte COLON
public static final byte CR
public static final byte LF
public static final byte SP
public static final byte HTAB
public RawMessage(int maxAllowedInitialLineSize, int maxAllowedHeaderSize, int maxAllowedContentLength)
maxAllowedInitialLineSize
- the maximum allowed size (in bytes) of the initial line.maxAllowedHeaderSize
- the maximum allowed size (in bytes) of all the headers
combined.maxAllowedContentLength
- the maximum allowed size (in bytes) of the payload of the
message.public void write(byte b) throws MaxMessageSizeExceededException, java.io.IOException
MaxMessageSizeExceededException
java.io.IOException
public static boolean isDigit(char ch)
public static boolean isDigit(byte b)
public boolean isComplete()
public io.pkts.buffer.Buffer getInitialLine()
public void writeToInitialLine(byte b) throws MaxMessageSizeExceededException
b
- MaxMessageSizeExceededException
public io.pkts.buffer.Buffer getHeaders()
public void writeToHeaders(byte b) throws MaxMessageSizeExceededException
b
- the byte to writeMaxMessageSizeExceededException
public io.pkts.buffer.Buffer getPayload()
public void writeToPayload(byte b) throws MaxMessageSizeExceededException
b
- MaxMessageSizeExceededException
public int getPayloadWriteIndex()
ChannelBuffer
runs
out of bytes. Therefore, you must check how much you have read "manually"
and based on that decide whether you are done with processing the payload
of this message or not.public boolean payloadCompleted()
public int getContentLength()
public void setContentLength(int contentLength) throws MaxMessageSizeExceededException
MaxMessageSizeExceededException
.contentLength
- the content length of the payloadMaxMessageSizeExceededException
- in case the payload exceeds the maximum allowed length.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2015. All Rights Reserved.