Package org.apache.mina.core.buffer

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


                errorEncoder.encode( buf.buf(), ( ChangePasswordError ) message );
            }
        }

        // mark position
        int pos = buf.position();

        // length is the data minus 4 bytes for the pre-pended length
        int recordLength = buf.position() - 4;

        // write the length
View Full Code Here


        // mark position
        int pos = buf.position();

        // length is the data minus 4 bytes for the pre-pended length
        int recordLength = buf.position() - 4;

        // write the length
        buf.rewind();
        buf.putInt( recordLength );
View Full Code Here

        // write the length
        buf.rewind();
        buf.putInt( recordLength );

        // set the position back before flipping the buffer
        buf.position( pos );
        buf.flip();

        out.write( buf );
    }
}
View Full Code Here

        buf.putShort( ( short ) 0 );

        encoder.encode( buf, ( DnsMessage ) message );

        // mark position
        int end = buf.position();

        // length is the data minus 2 bytes for the pre-pended length
        short recordLength = ( short ) ( end - 2 );

        // write the length
View Full Code Here

        // write the length
        buf.rewind();
        buf.putShort( recordLength );

        // set the position back before flipping the buffer
        buf.position( end );
        buf.flip();

        out.write( buf );
    }
}
View Full Code Here

        StopWatch watch = new StopWatch();

        reader.parse(opening, CharsetUtil.UTF8_DECODER);
        for (int i = 0; i < 10000; i++) {
            buffer.position(0);
            reader.parse(buffer, CharsetUtil.UTF8_DECODER);
        }
        watch.stop();

        System.out.println(listener.counter + " stanzas parsed");
View Full Code Here

        String value = message.toString();
        IoBuffer buf = IoBuffer.allocate(value.length())
                .setAutoExpand(true);
        buf.putString(value, encoder);
        if (buf.position() > Integer.MAX_VALUE) {
            throw new IllegalArgumentException("Line length: " + buf.position());
        }
        buf.putString(m_delimiter.getValue(), encoder);
        buf.flip();
        out.write(buf);
View Full Code Here

        String value = message.toString();
        IoBuffer buf = IoBuffer.allocate(value.length())
                .setAutoExpand(true);
        buf.putString(value, encoder);
        if (buf.position() > Integer.MAX_VALUE) {
            throw new IllegalArgumentException("Line length: " + buf.position());
        }
        buf.putString(m_delimiter.getValue(), encoder);
        buf.flip();
        out.write(buf);
  }
View Full Code Here

      return null;
    }
     
    IoBuffer buf = (IoBuffer)currSession.getAttribute("buffer");
   
    int pos = buf.position();
    int limit = buf.limit();
   
    buf.flip();
    buf.position(0);
    int len = buf.remaining();
View Full Code Here

   
    int pos = buf.position();
    int limit = buf.limit();
   
    buf.flip();
    buf.position(0);
    int len = buf.remaining();
    byte [] bytes = new byte[len];
    buf.get(bytes);
   
    buf.position(pos);
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.