Package org.apache.mina.common

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


        }
      }
    }

    result.flip();
    writtenBytes += result.limit();
    return result;
  }

  /** {@inheritDoc} */
    @Override
View Full Code Here


                continue;
            }
            serializeStatusObject(out, statusObject);
            out.flip();
            log.debug(HexDump.formatHexDump(out.getHexDump()));
            byte[] cachedBytes = new byte[out.limit()];
            out.get(cachedBytes);
            out.clear();
            cachedStatusObjects.put(statusCode, cachedBytes);
        }
        out.release();
View Full Code Here

    }
    props.put("canSeekToEnd", true);
    out.writeMap(props, new Serializer());
    buf.flip();

    ITag result = new Tag(IoConstants.TYPE_METADATA, 0, buf.limit(), null,
        0);
    result.setBody(buf);
    return result;
  }
View Full Code Here

       
        ByteBuffer buf = ByteBuffer.allocate( objectSize + 4, false );
        buf.putInt( objectSize );
        in.readFully( buf.array(), 4, objectSize );
        buf.position( 0 );
        buf.limit( objectSize + 4 );
       
        Object answer = buf.getObject( classLoader );
        buf.release();
        return answer;
    }
View Full Code Here

                in.position(pos);

                if (ctx.getOverflowPosition() == 0) {
                    ByteBuffer buf = ctx.getBuffer();
                    buf.flip();
                    buf.limit(buf.limit() - matchCount);
                    try {
                        out.write(buf.getString(ctx.getDecoder()));
                    } finally {
                        buf.clear();
                    }
View Full Code Here

                in.position(pos);

                if (ctx.getOverflowPosition() == 0) {
                    ByteBuffer buf = ctx.getBuffer();
                    buf.flip();
                    buf.limit(buf.limit() - matchCount);
                    try {
                        out.write(buf.getString(ctx.getDecoder()));
                    } finally {
                        buf.clear();
                    }
View Full Code Here

                    in.position(pos);

                    if (ctx.getOverflowPosition() == 0) {
                        ByteBuffer buf = ctx.getBuffer();
                        buf.flip();
                        buf.limit(buf.limit() - matchCount);
                        try {
                            out.write(buf.getString(ctx.getDecoder()));
                        } catch (Exception e) {
                          // cater for KOI-8R
                        } finally {
View Full Code Here

                    in.position(pos);

                    if (ctx.getOverflowPosition() == 0) {
                        ByteBuffer buf = ctx.getBuffer();
                        buf.flip();
                        buf.limit(buf.limit() - matchCount);
                        try {
                            out.write(buf.getString(ctx.getDecoder()));
                        } catch (Exception e) {
                          // cater for KOI-8R
                        } finally {
View Full Code Here

        readBuf.clear();
        WriteFuture writeFuture = null;
        for( int i = 0; i < COUNT; i ++ )
        {
            ByteBuffer buf = ByteBuffer.allocate( DATA_SIZE );
            buf.limit( DATA_SIZE );
            fillWriteBuffer( buf, i );
            buf.flip();
           
            writeFuture = session.write( buf );
           
View Full Code Here

        readBuf.flip();
        SessionLog.info( session, "readBuf: " + readBuf );
        Assert.assertEquals( DATA_SIZE * COUNT, readBuf.remaining() );
        ByteBuffer expectedBuf = ByteBuffer.allocate( DATA_SIZE * COUNT );
        for( int i = 0; i < COUNT; i ++ ) {
            expectedBuf.limit( ( i + 1 ) * DATA_SIZE );
            fillWriteBuffer( expectedBuf, i );
        }
        expectedBuf.position( 0 );
       
        assertEquals(expectedBuf, readBuf);
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.