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

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

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

ByteBuffer.get介绍

暂无

代码示例

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

public ByteBuffer get( byte[] dst )
{
  buf.get( dst );
  return this;
}

代码示例来源:origin: alibaba/tair-java-client

in.get(data);

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

public ByteBuffer get( byte[] dst, int offset, int length )
{
  buf.get( dst, offset, length );
  return this;
}

代码示例来源:origin: org.apache.directory.server/mitosis

in.get(); // skip type field
sequence = in.getInt();
bodyLength = in.getInt();

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

/**
 * Reads one unsigned byte as a short integer.
 */
public short getUnsigned()
{
  return (short)( get() & 0xff );
}

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

/**
 * Reads one byte as an unsigned short integer.
 */
public short getUnsigned( int index )
{
  return (short)( get( index ) & 0xff );
}

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

/**
 * @see java.nio.ByteBuffer#get(byte[])
 */
public ByteBuffer get( byte[] dst )
{
  return get( dst, 0, dst.length );
}

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

public byte get()
{
  return buf.get();
}

代码示例来源:origin: org.apache.directory.server/mitosis

public final MessageDecoderResult decodable( IoSession session, ByteBuffer buf )
{
  return type == buf.get() ? OK : NOT_OK;
}

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

public byte get( int index )
{
  return buf.get( index );
}

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

public int read() throws IOException
{
  synchronized( mutex )
  {
    if( !waitForData() )
    {
      return -1;
    }
    return buf.get() & 0xff;
  }
}

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

public int read()
{
  if( ByteBuffer.this.hasRemaining() )
  {
    return ByteBuffer.this.get() & 0xff;
  }
  else
  {
    return -1;
  }
}

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

public int read( byte[] b, int off, int len )
{
  int remaining = ByteBuffer.this.remaining();
  if( remaining > 0 )
  {
    int readBytes = Math.min( remaining, len );
    ByteBuffer.this.get( b, off, readBytes );
    return readBytes;
  }
  else
  {
    return -1;
  }
}

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

/**
 * Dispatches a complete message to this connection's
 * {@code ConnectionListener}.
 * 
 * @param buf a {@code MINA ByteBuffer} containing the message to dispatch
 */
public void filteredMessageReceived(ByteBuffer buf) {
  byte[] message = new byte[buf.remaining()];
  buf.get(message);
  listener.bytesReceived(this, message);
}

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

public int hashCode()
{
  int h = 1;
  int p = position();
  for( int i = limit() - 1; i >= p; i -- )
  {
    h = 31 * h + get( i );
  }
  return h;
}

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

int byteValue = in.get() & 0xFF;
out.append( ( char ) highDigits[ byteValue ] );
out.append( ( char ) lowDigits[ byteValue ] );
  byteValue = in.get() & 0xFF;
  out.append( ( char ) highDigits[ byteValue ] );
  out.append( ( char ) lowDigits[ byteValue ] );

代码示例来源:origin: org.apache.directory.server/mitosis

protected BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, ByteBuffer in ) throws Exception
{
  byte[] src = new byte[in.remaining()];
  in.get( src );
  return new LogEntryMessage( sequence, operationCodec.decode( registries, src ) );
}

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

public boolean equals( Object o )
{
  if( !( o instanceof ByteBuffer ) )
  {
    return false;
  }
  ByteBuffer that = (ByteBuffer)o;
  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 );
    byte v2 = that.get( j );
    if( v1 != v2 )
    {
      return false;
    }
  }
  return true;
}

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

public int compareTo( Object o )
{
  ByteBuffer that = (ByteBuffer)o;
  int n = this.position() + Math.min( this.remaining(), that.remaining() );
  for( int i = this.position(), j = that.position(); i < n; i ++, j ++ )
  {
    byte v1 = this.get( i );
    byte v2 = that.get( j );
    if( v1 == v2 )
    {
      continue;
    }
    if( v1 < v2 )
    {
      return -1;
    }
    return +1;
  }
  return this.remaining() - that.remaining();
}

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

public int read( byte[] b, int off, int len ) throws IOException
{
  synchronized( mutex )
  {
    if( !waitForData() )
    {
      return -1;
    }
    int readBytes;
    if( len > buf.remaining() )
    {
      readBytes = buf.remaining();
    }
    else
    {
      readBytes = len;
    }
    buf.get( b, off, readBytes );
    return readBytes;
  }
}

相关文章