remaining() public method

public remaining ( ) : long
return long
Esempio n. 1
0
        public int write(ByteBuffer src)
        {
            int toWrite = (int)src.remaining();
            byte[] message = new byte[toWrite];

            src.get(ref message);

            theStream.Write(message,0,toWrite);

            return toWrite;
        }
Esempio n. 2
0
        public static int count(ByteBuffer buf)
        {
            int num = 0;
            long pos = buf.position();

            while (buf.remaining() >= 32) {
                int typeType   = buf.getInt();
                int typeNumEl  = buf.getInt();
                int valueType  = buf.getInt();
                int valueNumEl = buf.getInt();
                buf.getInt(); // sample
                buf.getInt(); // offset
                buf.getInt(); // duration
                int size = buf.getInt();
                int sizeType  = typeNumEl  * DataType.wordSize[typeType];
                int sizeValue = valueNumEl * DataType.wordSize[valueType];

                if (sizeType < 0 || sizeValue < 0 || sizeType + sizeValue > size) {
                    return -(1+num);
                }

                buf.position(buf.position() + size);
                num++;
            }
            buf.position(pos);
            return num;
        }