Package org.glassfish.grizzly.http.util
Class HttpCodecUtils
java.lang.Object
org.glassfish.grizzly.http.util.HttpCodecUtils
General HttpCodec utility methods.
- Author:
- Alexey Stashok
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcheckEOL(HttpCodecFilter.HeaderParsingState parsingState, byte[] input, int end) static intcheckEOL(HttpCodecFilter.HeaderParsingState parsingState, Buffer input) static booleanfindEOL(HttpCodecFilter.HeaderParsingState state, byte[] input, int end) static booleanfindEOL(HttpCodecFilter.HeaderParsingState state, Buffer input) static intfindSpace(byte[] input, int offset, int end, int packetLimit) static intstatic BuffergetLongAsBuffer(MemoryManager memoryManager, long length) static intstatic booleanisNonPrintableUsAscii(int ub) Returns true if the passed symbol code represents a non-printable US-ASCII symbol in range [Integer.MIN_VALUE; 9) U (9; 31] U [127; Integer.MAX_VALUE].static booleanisNotSpaceAndTab(byte b) static booleanisSpaceOrTab(byte b) static voidparseHost(DataChunk hostDC, DataChunk serverNameDC, HttpRequestPacket request) static Bufferput(MemoryManager memoryManager, Buffer dstBuffer, byte value) static Bufferput(MemoryManager memoryManager, Buffer dstBuffer, byte[] array) static Bufferput(MemoryManager memoryManager, Buffer dstBuffer, byte[] array, int off, int len) static Bufferput(MemoryManager memoryManager, Buffer dstBuffer, byte[] tempBuffer, String s) static Bufferput(MemoryManager memoryManager, Buffer dstBuffer, byte[] tempBuffer, DataChunk chunk) static Bufferput(MemoryManager memoryManager, Buffer dstBuffer, Buffer buffer) static BufferresizeBuffer(MemoryManager memoryManager, Buffer buffer, int grow) static intskipSpaces(byte[] input, int offset, int end, int packetLimit) static intskipSpaces(Buffer input, int offset, int packetLimit) static byte[]Converts the aCharSequenceto a byte array, eliminating all the unprintable US-ASCII symbols by replacing them with spaces (' ').static byte[]toCheckedByteArray(CharSequence s, byte[] dstArray, int arrayOffs) Serializes the passedCharSequenceinto a passed byte array starting from a given offset.
-
Constructor Details
-
HttpCodecUtils
public HttpCodecUtils()
-
-
Method Details
-
parseHost
-
checkEOL
-
checkEOL
-
findEOL
-
findEOL
-
findSpace
-
findSpace
public static int findSpace(byte[] input, int offset, int end, int packetLimit) -
skipSpaces
-
skipSpaces
public static int skipSpaces(byte[] input, int offset, int end, int packetLimit) -
indexOf
-
getLongAsBuffer
-
put
public static Buffer put(MemoryManager memoryManager, Buffer dstBuffer, byte[] tempBuffer, DataChunk chunk) -
put
public static Buffer put(MemoryManager memoryManager, Buffer dstBuffer, byte[] tempBuffer, String s) -
put
-
put
public static Buffer put(MemoryManager memoryManager, Buffer dstBuffer, byte[] array, int off, int len) -
put
-
put
-
resizeBuffer
-
isNotSpaceAndTab
public static boolean isNotSpaceAndTab(byte b) -
isSpaceOrTab
public static boolean isSpaceOrTab(byte b) -
toCheckedByteArray
Converts the aCharSequenceto a byte array, eliminating all the unprintable US-ASCII symbols by replacing them with spaces (' ').- Parameters:
s-CharSequence- Returns:
- a converted byte array, where all the char sequence's unprintable US-ASCII symbols have been replaced with spaces (' ')
-
toCheckedByteArray
Serializes the passedCharSequenceinto a passed byte array starting from a given offset. All the unprintable US-ASCII symbols will be replaced with spaces (' ').- Parameters:
s-CharSequencedstArray- the byte array to be used to convert the CharSequence intoarrayOffs- the offset in the byte array, where the serialization will be started- Returns:
- the passed dstArray
- Throws:
IllegalArgumentException- if there is no enough space in the dstArray to serialize the CharSequence
-
isNonPrintableUsAscii
public static boolean isNonPrintableUsAscii(int ub) Returns true if the passed symbol code represents a non-printable US-ASCII symbol in range [Integer.MIN_VALUE; 9) U (9; 31] U [127; Integer.MAX_VALUE].- Parameters:
ub- the symbol code to check- Returns:
- true if the passed symbol code represents a non-printable US-ASCII symbol in range [Integer.MIN_VALUE; 9) U (9; 31] U [127; Integer.MAX_VALUE]
-