javazoom.jl.decoder.CircularByteBuffer.Push C# (CSharp) Method

Push() public method

Push a byte into the buffer. Returns the value of whatever comes off.
public Push ( byte newValue ) : byte
newValue byte
return byte
        public byte Push(byte newValue)
        {
            byte ret;
            lock(this)
            {
                ret = InternalGet(length);
                dataArray[index] = newValue;
                numValid++; if (numValid>length) numValid = length;
                index++;
                index %= length;
            }
            return ret;
        }

Usage Example

示例#1
0
文件: BackStream.cs 项目: rejc2/utils
        public int Read(sbyte[] toRead, int offset, int length)
        {
            // Read
            int  currentByte   = 0;
            bool canReadStream = true;

            while (currentByte < length && canReadStream)
            {
                if (NumForwardBytesInBuffer > 0)
                {                 // from mem
                    NumForwardBytesInBuffer--;
                    toRead[offset + currentByte] = (sbyte)COB[NumForwardBytesInBuffer];
                    currentByte++;
                }
                else
                {                 // from stream
                    int newBytes = length - currentByte;
                    int numRead  = S.Read(Temp, 0, newBytes);
                    canReadStream = numRead >= newBytes;
                    for (int i = 0; i < numRead; i++)
                    {
                        COB.Push(Temp[i]);
                        toRead[offset + currentByte + i] = (sbyte)Temp[i];
                    }
                    currentByte += numRead;
                }
            }
            return(currentByte);
        }
All Usage Examples Of javazoom.jl.decoder.CircularByteBuffer::Push