Position() публичный Метод

public Position ( ) : int
Результат int
Пример #1
0
        public int Read(ByteBuffer buffer)
        {
            int offset = buffer.Position() + buffer.ArrayOffset();
            int num2   = s.Read(buffer.Array(), offset, (buffer.Limit() + buffer.ArrayOffset()) - offset);

            buffer.Position(buffer.Position() + num2);
            return(num2);
        }
Пример #2
0
        public int Write(ByteBuffer buffer)
        {
            int offset = buffer.Position() + buffer.ArrayOffset();
            int count  = (buffer.Limit() + buffer.ArrayOffset()) - offset;

            s.Write(buffer.Array(), offset, count);
            buffer.Position(buffer.Position() + count);
            return(count);
        }
Пример #3
0
 public static string Decode(this Encoding e, ByteBuffer buffer)
 {
     return(e.Decode(buffer.Array(), buffer.ArrayOffset() + buffer.Position(), buffer.Limit() - buffer.Position()));
 }
Пример #4
0
 // 渡されたByteBufferを切り诘めた、新しいByteBufferを作る
 private ByteBuffer CompactByteBuffer(ByteBuffer b)
 {
     int count = b.Position();
     ByteBuffer ret = ByteBuffer.AllocateDirect(count);
     b.Position(0);
     for (int i = 0; i < count; i++)
     {
         ret.Put(b.Get());
     }
     ret.Position(0);
     return ret;
 }