Available Methods
- writeBytes ( )
- readableBytes ( )
- writeByte ( )
- release ( )
- writeInt ( )
- readBytes ( )
- readInt ( )
- readByte ( )
- writeShort ( )
- readerIndex ( )
- writeBoolean ( )
- isReadable ( )
- skipBytes ( )
- writerIndex ( )
- readUnsignedByte ( )
- writeLong ( )
- readBoolean ( )
- toString ( )
- readUnsignedShort ( )
- getByte ( )
- markReaderIndex ( )
- resetReaderIndex ( )
- readLong ( )
- readShort ( )
- getBytes ( )
- slice ( )
- writeIntLE ( )
- readSlice ( )
- writeFloatLE ( )
- writeCharSequence ( )
- writeZero ( )
- nioBuffer ( )
- writeShortLE ( )
- retain ( )
- readUnsignedInt ( )
- hasArray ( )
- writeLongLE ( )
- array ( )
- getUnsignedByte ( )
- readFloatLE ( )
- capacity ( )
- writeFloat ( )
- writeDouble ( )
- writeMedium ( )
- setInt ( )
- readDouble ( )
- readIntLE ( )
- forEachByte ( )
- clear ( )
- getInt ( )
- readUnsignedShortLE ( )
- copy ( )
- ensureWritable ( )
- readShortLE ( )
- readLongLE ( )
- order ( )
- arrayOffset ( )
- setByte ( )
- refCnt ( )
- internalNioBuffer ( )
- readFloat ( )
- nioBufferCount ( )
- getShort ( )
- readRetainedSlice ( )
- getLong ( )
- readUnsignedIntLE ( )
- resetWriterIndex ( )
- setBytes ( )
- writeMediumLE ( )
- indexOf ( )
- retainedSlice ( )
- retainedDuplicate ( )
- isWritable ( )
- readCharSequence ( )
- isDirect ( )
- bytesBefore ( )
- getUnsignedShort ( )
- duplicate ( )
- hasMemoryAddress ( )
- readUnsignedMediumLE ( )
- writableBytes ( )
- memoryAddress ( )
- markWriterIndex ( )
- discardReadBytes ( )
- nioBuffers ( )
- touch ( )
- setIntLE ( )
- getUnsignedMedium ( )
- getUnsignedInt ( )
- equals ( )
- setShort ( )
- writeChar ( )
- maxCapacity ( )
- setMediumLE ( )
- forEachByteDesc ( )
- getDouble ( )
- writeDoubleLE ( )
- getIntLE ( )
- readChar ( )
- getCharSequence ( )
- setLong ( )
- setShortLE ( )
- setIndex ( )
Related Classes
- java.util.Arrays
- java.util.Collections
- java.util.concurrent.TimeUnit
- java.util.UUID
- java.nio.charset.Charset
- java.net.URI
- java.nio.ByteBuffer
- org.junit.Assert
- java.util.Optional
- java.nio.charset.StandardCharsets
- java.net.InetSocketAddress
- java.util.concurrent.CountDownLatch
- com.google.common.collect.Lists
- org.mockito.Mockito
- java.util.concurrent.CompletableFuture
- com.google.common.base.Preconditions
- org.junit.jupiter.api.Test
- io.netty.channel.ChannelHandlerContext
- org.testng.annotations.Test
- io.netty.channel.Channel
- io.netty.buffer.Unpooled
- io.netty.channel.ChannelFuture
- io.netty.channel.ChannelFutureListener
- reactor.core.publisher.Mono
- reactor.core.publisher.Flux
Java Code Examples for io.netty.buffer.ByteBuf#forEachByteDesc()
The following examples show how to use
io.netty.buffer.ByteBuf#forEachByteDesc() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewHandler.java From couchbase-jvm-core with Apache License 2.0 | 5 votes |
/** * Parse out the info portion from the header part of the query response. * * This includes the total rows, but also debug info if attached. */ private void parseViewInfo() { int rowsStart = -1; for (int i = responseContent.readerIndex(); i < responseContent.writerIndex() - 2; i++) { byte curr = responseContent.getByte(i); byte f1 = responseContent.getByte(i + 1); byte f2 = responseContent.getByte(i + 2); if (curr == '"' && f1 == 'r' && f2 == 'o') { rowsStart = i; break; } } if (rowsStart == -1) { return; } ByteBuf info = responseContent.readBytes(rowsStart - responseContent.readerIndex()); int closingPointer = info.forEachByteDesc(new ByteBufProcessor() { @Override public boolean process(byte value) throws Exception { return value != ','; } }); if (closingPointer > 0) { info.setByte(closingPointer, '}'); viewInfoObservable.onNext(info); } else { //JVMCBC-360 don't forget to release the now unused info ByteBuf info.release(); viewInfoObservable.onNext(Unpooled.EMPTY_BUFFER); } viewInfoObservable.onCompleted(); viewParsingState = QUERY_STATE_ROWS; }
Example 2
Source File: HttpObjectDecoder.java From servicetalk with Apache License 2.0 | 4 votes |
private void parseHeaderLine(final HttpHeaders headers, final ByteBuf buffer, final int lfIndex) { // https://tools.ietf.org/html/rfc7230#section-3.2 // header-field = field-name ":" OWS field-value OWS // // field-name = token // field-value = *( field-content / obs-fold ) // field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] // field-vchar = VCHAR / obs-text // // obs-fold = CRLF 1*( SP / HTAB ) // ; obsolete line folding // ; see Section 3.2.4 // OWS = *( SP / HTAB ) // ; optional whitespace // https://tools.ietf.org/html/rfc7230#section-3.2.4 // No whitespace is allowed between the header field-name and colon. In // the past, differences in the handling of such whitespace have led to // security vulnerabilities in request routing and response handling. final int nonControlIndex = lfIndex - 2; final int nameStart = buffer.readerIndex(); // Other checks will be done by header validator if enabled by users final int nameEnd = buffer.forEachByte(nameStart, nonControlIndex - nameStart + 1, FIND_COLON); if (nameEnd < 0) { throw new IllegalArgumentException("Unable to find end of header name"); } if (nameEnd == nameStart) { throw new IllegalArgumentException("Empty header name"); } // We assume the allocator will not leak memory, and so we retain + slice to avoid copying data. final CharSequence name = newAsciiString(newBufferFrom(buffer.retainedSlice(nameStart, nameEnd - nameStart))); final int valueStart; if (nameEnd >= nonControlIndex || (valueStart = buffer.forEachByte(nameEnd + 1, nonControlIndex - nameEnd, FIND_FIELD_VALUE)) < 0) { headers.add(name, emptyAsciiString()); } else { final int valueEnd = buffer.forEachByteDesc(valueStart, nonControlIndex - valueStart + 1, FIND_FIELD_VALUE); // We assume the allocator will not leak memory, and so we retain + slice to avoid copying data. headers.add(name, newAsciiString(newBufferFrom(buffer.retainedSlice(valueStart, valueEnd - valueStart + 1)))); } // Consume the header line bytes from the buffer. consumeCRLF(buffer, lfIndex); }