Examples of remaining()


Examples of org.apache.mina.codec.IoBuffer.remaining()

    public void testTruncatedValues() {
        for (int value : new int[] { 0, 1, 127, 128, 65536, 198649, Integer.MAX_VALUE }) {

            IoBuffer buffer = IoBuffer.wrap(encoder.encode(value));

            for (int i = 0; i < buffer.remaining(); i++) {
                IoBuffer partialBuffer = buffer.slice();
                partialBuffer.limit(partialBuffer.position() + i);
                try {
                    assertNull(decoder.decode(partialBuffer));
                } catch (ProtocolDecoderException e) {
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.remaining()

        };

        encoder.encode(session, "ABC", out);
        Assert.assertEquals(1, out.getBufferQueue().size());
        ByteBuffer buf = out.getBufferQueue().poll();
        Assert.assertEquals(5, buf.remaining());
        Assert.assertEquals('A', buf.get());
        Assert.assertEquals('B', buf.get());
        Assert.assertEquals('C', buf.get());
        Assert.assertEquals('\r', buf.get());
        Assert.assertEquals('\n', buf.get());
View Full Code Here

Examples of org.apache.mina.common.IoBuffer.remaining()

            return false;
        }
       
        IoBuffer buf = (IoBuffer) message;
        int offset = buf.position();
        return buf.remaining() == 23 &&
               buf.get(offset + 0) == 0x15 && buf.get(offset + 1) == 0x03 &&
               buf.get(offset + 2) == 0x01 && buf.get(offset + 3) == 0x00 &&
               buf.get(offset + 4) == 0x12;
    }
View Full Code Here

Examples of org.apache.mina.core.buffer.IoBuffer.remaining()

       
        if (buf.hasRemaining()) {
            int length;
           
            if (hasFragmentation) {
                length = Math.min(buf.remaining(), maxLength);
            } else {
                length = buf.remaining();
            }
           
            localWrittenBytes = write(session, buf, length);
View Full Code Here

Examples of org.apache.poi.hssf.record.RecordInputStream.remaining()

   * The correct size of a {@link ChartFormatRecord} is 20 bytes (not including header).
   */
  public void testLoad() {
    RecordInputStream in = TestcaseRecordInputStream.create(data);
    ChartFormatRecord record = new ChartFormatRecord(in);
    if (in.remaining() == 2) {
      throw new AssertionFailedError("Identified bug 44693d");
    }
    assertEquals(0, in.remaining());
    assertEquals(24, record.getRecordSize());

View Full Code Here

Examples of org.apache.qpid.proton.codec.CompositeWritableBuffer.remaining()

            CompositeWritableBuffer outputBuffer =
                    new CompositeWritableBuffer(
                       new WritableBuffer.ByteBufferWrapper(ByteBuffer.wrap(bytes, offset + written, size - written)),
                       new WritableBuffer.ByteBufferWrapper(_overflowBuffer));

            if( outputBuffer.remaining() >= _maxFrameSize ) { written += processHeader(outputBuffer);
            if( outputBuffer.remaining() >= _maxFrameSize ) { written += processOpen(outputBuffer);
            if( outputBuffer.remaining() >= _maxFrameSize ) { written += processBegin(outputBuffer);
            if( outputBuffer.remaining() >= _maxFrameSize ) { written += processAttach(outputBuffer);
            if( outputBuffer.remaining() >= _maxFrameSize ) { written += processReceiverDisposition(outputBuffer);
            if( outputBuffer.remaining() >= _maxFrameSize ) { written += processReceiverFlow(outputBuffer);
View Full Code Here

Examples of org.apache.qpid.typedmessage.TypedBytesContentReader.remaining()

        else if("jms/stream-message".equals(mimeType))
        {
            TypedBytesContentReader reader = new TypedBytesContentReader(ByteBuffer.wrap(data));

            List list = new ArrayList();
            while (reader.remaining() != 0)
            {
                try
                {
                    list.add(fixValue(reader.readObject()));
                }
View Full Code Here

Examples of org.apache.tomcat.lite.io.BBucket.remaining()

                    received(body, sb);
                    //log.info("Queue received buffer " + this + " " + lenToConsume);
                    bodys.remaining = 0;
                } else {
                    BBucket first = rawReceiveBuffers.popFirst();
                    bodys.remaining -= first.remaining();
                    received(body, first);
                    //log.info("Queue full received buffer " + this + " RAW: " + rawReceiveBuffers);
                }
                if (bodys.contentLength >= 0 && bodys.remaining == 0) {
                    // Content-Length, all done
View Full Code Here

Examples of org.apache.tomcat.lite.io.BBuffer.remaining()

        // process each "cookie" header
        for (int i = 0; i < msgBytes.headerCount; i++) {
            if (msgBytes.getHeaderName(i).equalsIgnoreCase("Cookie")) {
                BBuffer bc = msgBytes.getHeaderValue(i);
                if (bc.remaining() == 0) {
                    continue;
                }
                processCookieHeader(cookies, cookiesCache,
                        bc.array(),
                        bc.getOffset(),
View Full Code Here

Examples of org.apache.tomcat.spdy.SpdyFrame.remaining()

        // Set this every time in case limit has been changed via JMX
        mimeHeaders.setLimit(endpoint.getMaxHeaderCount());

        for (int i = 0; i < frame.nvCount; i++) {
            int nameLen = frame.read16();
            if (nameLen > frame.remaining()) {
                throw new IOException("Name too long");
            }

            keyBuffer.setBytes(frame.data, frame.off, nameLen);
            if (keyBuffer.equals("method")) {
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.