Package org.glassfish.grizzly

Examples of org.glassfish.grizzly.Buffer.remaining()


            }
           
            final Buffer message = record.getMessage();
            final int pos = message.position();
           
            final int messageRemaining = message.remaining();

            final BufferArray bufferArray =
                    (totalRemaining >= messageRemaining) ?
                    message.toBufferArray() :
                    message.toBufferArray(pos, pos + totalRemaining);
View Full Code Here


        for (int i = 0; i < size; i++) {
           
            final Buffer buffer = buffers[i];
            assert !buffer.isComposite();
           
            final int bufferSize = buffer.remaining();
            if (bufferSize == 0) {
                continue;
            } else if (buffer.isDirect()) {
                ioRecord.finishBufferSlice();
                ioRecord.putToArray(buffer.toByteBuffer());
View Full Code Here

            if (totalRemaining < copyThreshold) {
                return move(connection.getTransport().getMemoryManager(),
                        originalMessage);
            }
            if (lastOutputBuffer.remaining() < copyThreshold) {
                final Buffer tmpBuf =
                        copy(connection.getTransport().getMemoryManager(),
                        originalMessage);

                if (originalMessage.isComposite()) {
View Full Code Here

            if (error != null) throw error;
            if (isComplete) return false;

            final Buffer buffer = context.getMessage();

            final int newSize = sizeInBytes + buffer.remaining();
            if (newSize > maxPendingBytes) {
                throw new PendingWriteQueueLimitExceededException(
                        "Max queued data limit exceeded: "
                        + newSize + '>' + maxPendingBytes);
            }
View Full Code Here

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Buffer) {
            Buffer that = (Buffer) obj;
            if (this.remaining() != that.remaining()) {
                return false;
            }
            int p = this.position();
            for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--) {
                byte v1 = this.get(i);
View Full Code Here

   
    static Buffer allocateOutputBuffer(final int size/*, final int counter*/) {
       
        Buffer buffer = ThreadCache.takeFromCache(SSL_OUTPUT_BUFFER_IDX);
        final boolean hasBuffer = (buffer != null);
        if (!hasBuffer || buffer.remaining() < size) {
            final ByteBuffer byteBuffer;
                byteBuffer = ByteBuffer.allocate(size);
           
            buffer = new ByteBufferWrapper(byteBuffer) {

View Full Code Here

//        Init();
        final Buffer inputBuffer = decoderState.getSrc();
        m_RangeDecoder.initFromState(decoderState);
        m_OutWindow.initFromState(decoderState);
        if (!decoderState.isInitialized()) {
            if (inputBuffer.remaining() < 13) {
                return State.NEED_MORE_DATA;
            }

            decoderState.initialize(inputBuffer);
            init();
View Full Code Here

            return;
        }

        Buffer dst = _decoderState.getDst();

        if (dst == null || dst.remaining() < size) {
            dst = resizeBuffer(_decoderState.getMemoryManager(), dst, size);
            _decoderState.setDst(dst);
        }
        dst.put(_buffer, _streamPos, size);
        dst.trim();
View Full Code Here

            } catch (HttpBrokenContentException e) {
                final Throwable cause = e.getCause();
                throw Exceptions.makeIOException(cause != null ? cause : e);
            }
           
            read += b.remaining();
            updateInputContentBuffer(b);
            c.recycle();
           
            if (isLast) {
                finished();
View Full Code Here

        }

        int read = 0;
        try {
            final Buffer formData = getPostBody(len);
            read = formData.remaining();
            parameters.processParameters(formData, formData.position(), read);
        } catch (Exception ignored) {
        } finally {
            try {
                skipPostBody(read);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.