org.apache.mina.common.ByteBuffer.skip()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.apache.mina.common.ByteBuffer.skip()方法的一些代码示例,展示了ByteBuffer.skip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuffer.skip()方法的具体详情如下:
包路径:org.apache.mina.common.ByteBuffer
类名称:ByteBuffer
方法名:skip

ByteBuffer.skip介绍

[英]Forwards the position of this buffer as the specified size bytes.
[中]将此缓冲区的位置作为指定的size字节转发。

代码示例

代码示例来源:origin: org.apache.directory.mina/mina-core

public ByteBuffer skip( int size )
{
  buf.skip( size );
  return this;
}

代码示例来源:origin: org.apache.directory.mina/mina-core

public long skip( long n )
  {
    int bytes;
    if( n > Integer.MAX_VALUE )
    {
      bytes = ByteBuffer.this.remaining();
    }
    else
    {
      bytes = Math.min( ByteBuffer.this.remaining(), (int)n );
    }
    ByteBuffer.this.skip( bytes );
    return bytes;
  }
};

代码示例来源:origin: org.apache.directory.mina/mina-core

/**
 * Writes the specified Java object to the buffer.
 */
public ByteBuffer putObject( Object o )
{
  int oldPos = position();
  skip( 4 ); // Make a room for the length field.
  try
  {
    ObjectOutputStream out = new ObjectOutputStream( asOutputStream() )
    {
      protected void writeClassDescriptor( ObjectStreamClass desc ) throws IOException
      {
        writeUTF( desc.getName() );
      }
    };
    out.writeObject( o );
    out.flush();
  }
  catch( IOException e )
  {
    throw new BufferDataException( e );
  }
  // Fill the length field
  int newPos = position();
  position( oldPos );
  putInt( newPos - oldPos - 4 );
  position( newPos );
  return this;
}

代码示例来源:origin: org.apache.directory.mina/mina-core

int expectedLength = (int)( in.remaining() * encoder.averageBytesPerChar() ) + 1;
skip( prefixLength ); // make a room for the length field
int oldPos = position();
encoder.reset();

代码示例来源:origin: org.reddwarfserver.client/sgs-client

msgBuf.skip(msgLen);

相关文章