示例#1
0
 private void SwitchCurrentBuffer()
 {
     currentBuffer  = currentBufferIndex != file.NumBuffers() ? file.GetBuffer(currentBufferIndex) : file.AddBuffer(1024);
     bufferPosition = 0;
     bufferStart    = 1024L * currentBufferIndex;
     bufferLength   = currentBuffer.Length;
 }
示例#2
0
 private void SwitchCurrentBuffer(bool enforceEOF)
 {
     if (currentBufferIndex >= file.NumBuffers())
     {
         if (enforceEOF)
         {
             throw new IOException("Read past EOF");
         }
         --currentBufferIndex;
         bufferPosition = BUFFER_SIZE;
     }
     else
     {
         currentBuffer  = file.GetBuffer(currentBufferIndex);
         bufferPosition = 0;
         bufferStart    = BUFFER_SIZE * (long)currentBufferIndex;
         long num = length - bufferStart;
         bufferLength = num > (long)BUFFER_SIZE ? BUFFER_SIZE : (int)num;
     }
 }