CSJ2K.j2k.io.BufferedRandomAccessFile.readNewBuffer C# (CSharp) 메소드

readNewBuffer() 보호된 메소드

Reads a new buffer from the file. If there has been any changes made since the buffer was read, the buffer is first written to the file.
If an I/O error ocurred. /// ///
protected readNewBuffer ( int off ) : void
off int The offset where to move to. /// ///
리턴 void
        protected internal void readNewBuffer(int off)
        {
            /* If the buffer have changed. We need to write it to
            * the file before reading a new buffer.
            */
            if (byteBufferChanged)
            {
                flush();
            }
            // Don't allow to seek beyond end of file if reading only
            if (isReadOnly && off >= theFile.Length)
            {
                throw new System.IO.EndOfStreamException();
            }
            // Set new offset
            offset = off;

            theFile.Seek(offset, System.IO.SeekOrigin.Begin);

            maxByte = theFile.Read(byteBuffer, 0, byteBuffer.Length);
            position = 0;

            if (maxByte < byteBuffer.Length)
            {
                // Not enough data in input file.
                isEOFInBuffer = true;
                if (maxByte == - 1)
                {
                    maxByte++;
                }
            }
            else
            {
                isEOFInBuffer = false;
            }
        }