java.lang.Object
org.glassfish.grizzly.http.util.BufferChunk
- All Implemented Interfaces:
Chunk
Buffer chunk representation. Helps HTTP module to avoid redundant String creation.- Author:
- Alexey Stashok
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidallocate(int size) voidappend(BufferChunk bc) intintcompareIgnoreCase(int start, int end, String compareTo) voiddelete(int start, int end) booleanequals(byte[] b) Compares the message Buffer to the specified byte array.booleanequals(byte[] b, int offset, int len) Compares the message Buffer to the specified byte array.static booleanequals(byte[] c, int cOff, int cLen, org.glassfish.grizzly.Buffer t, int tOff, int tLen) booleanequals(char[] b, int offset, int len) Compares the message Buffer to the specified char array.booleanbooleanbooleanequalsIgnoreCase(byte[] b) booleanequalsIgnoreCase(byte[] b, int offset, int len) booleanequalsIgnoreCase(char[] b, int offset, int len) Compares the message Buffer to the specified char array ignoring case considerations.booleanbooleanbooleanequalsIgnoreCaseLowerCase(byte[] b) Compares the buffer chunk to the specified byte array representing lower-case ASCII characters.static booleanequalsIgnoreCaseLowerCase(org.glassfish.grizzly.Buffer buffer, int start, int end, byte[] cmpTo) Compares the buffer chunk to the specified byte array representing lower-case ASCII characters.intfindBytesAscii(byte[] b) Returns the starting index of the specified byte sequence within thisBuffer.org.glassfish.grizzly.BufferintgetEnd()final intintgetStart()inthash()inthashCode()final intindexOf(char c, int fromIndex) final intstatic intindexOf(org.glassfish.grizzly.Buffer buffer, int off, int end, char qq) static intindexOf(org.glassfish.grizzly.Buffer buffer, int off, int end, CharSequence s) final booleanisNull()protected voidNotify the Chunk that its content is going to be changed directlyfinal voidrecycle()protected final voidreset()protected final voidvoidsetBuffer(org.glassfish.grizzly.Buffer buffer) voidsetBufferChunk(org.glassfish.grizzly.Buffer buffer, int start, int end) voidsetBufferChunk(org.glassfish.grizzly.Buffer buffer, int start, int end, int limit) voidsetEnd(int end) voidsetStart(int start) static booleanstartsWith(org.glassfish.grizzly.Buffer buffer, int start, int end, byte[] cmpTo) booleanstartsWithIgnoreCase(String s, int pos) toString()toString(int start, int end) voidtrimLeft()
-
Constructor Details
-
BufferChunk
public BufferChunk()
-
-
Method Details
-
setBufferChunk
public void setBufferChunk(org.glassfish.grizzly.Buffer buffer, int start, int end) -
setBufferChunk
public void setBufferChunk(org.glassfish.grizzly.Buffer buffer, int start, int end, int limit) -
getBuffer
public org.glassfish.grizzly.Buffer getBuffer() -
setBuffer
public void setBuffer(org.glassfish.grizzly.Buffer buffer) -
getStart
public int getStart() -
setStart
public void setStart(int start) -
getEnd
public int getEnd() -
setEnd
public void setEnd(int end) -
getLength
public final int getLength() -
isNull
public final boolean isNull() -
allocate
public void allocate(int size) -
delete
public void delete(int start, int end) -
append
-
indexOf
public final int indexOf(char c, int fromIndex) -
indexOf
-
startsWithIgnoreCase
-
findBytesAscii
public int findBytesAscii(byte[] b) Returns the starting index of the specified byte sequence within thisBuffer.- Parameters:
b- byte sequence to search for.- Returns:
- the starting index of the specified byte sequence within this
Buffer
-
hashCode
public int hashCode() -
hash
public int hash() -
equals
-
equals
-
equals
public boolean equals(byte[] b) Compares the message Buffer to the specified byte array.- Parameters:
b- thebyte[]to compare- Returns:
- true if the comparison succeeded, false otherwise
- Since:
- 2.3
-
equals
public boolean equals(byte[] b, int offset, int len) Compares the message Buffer to the specified byte array.- Parameters:
b- thebyte[]to compareoffset- the offset in the arraylen- number of bytes to check- Returns:
- true if the comparison succeeded, false otherwise
- Since:
- 2.3
-
equals
public static boolean equals(byte[] c, int cOff, int cLen, org.glassfish.grizzly.Buffer t, int tOff, int tLen) -
equals
public boolean equals(char[] b, int offset, int len) Compares the message Buffer to the specified char array.- Parameters:
b- thechar[]to compareoffset- the offset in the arraylen- number of chars to check- Returns:
- true if the comparison succeeded, false otherwise
- Since:
- 2.3
-
equalsIgnoreCase
-
equalsIgnoreCase
-
equalsIgnoreCase
public boolean equalsIgnoreCase(byte[] b) -
equalsIgnoreCase
public boolean equalsIgnoreCase(byte[] b, int offset, int len) -
equalsIgnoreCase
public boolean equalsIgnoreCase(char[] b, int offset, int len) Compares the message Buffer to the specified char array ignoring case considerations.- Parameters:
b- thechar[]to compareoffset- the offset in the arraylen- number of chars to check- Returns:
- true if the comparison succeeded, false otherwise
- Since:
- 2.3
-
equalsIgnoreCaseLowerCase
public boolean equalsIgnoreCaseLowerCase(byte[] b) Compares the buffer chunk to the specified byte array representing lower-case ASCII characters.- Parameters:
b- thebyte[]to compare- Returns:
- true if the comparison succeeded, false otherwise
- Since:
- 2.1.2
-
toString
-
toString
-
toString
-
resetStringCache
protected final void resetStringCache() -
reset
protected final void reset() -
recycle
public final void recycle() -
notifyDirectUpdate
protected void notifyDirectUpdate()Notify the Chunk that its content is going to be changed directly -
indexOf
public static int indexOf(org.glassfish.grizzly.Buffer buffer, int off, int end, char qq) -
indexOf
-
compareIgnoreCase
- Returns:
- -1, 0 or +1 if inferior, equal, or superior to the String.
-
compare
- Returns:
- -1, 0 or +1 if inferior, equal, or superior to the String.
-
equalsIgnoreCaseLowerCase
public static boolean equalsIgnoreCaseLowerCase(org.glassfish.grizzly.Buffer buffer, int start, int end, byte[] cmpTo) Compares the buffer chunk to the specified byte array representing lower-case ASCII characters.- Parameters:
buffer- thebyte[]to comparestart- buffer startend- buffer endcmpTo- byte[] to compare against- Returns:
- true if the comparison succeeded, false otherwise
- Since:
- 2.1.2
-
startsWith
public static boolean startsWith(org.glassfish.grizzly.Buffer buffer, int start, int end, byte[] cmpTo) -
trimLeft
public void trimLeft()
-