コード例 #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
ファイル: RamInputStream.cs プロジェクト: fossabot/json-index
 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;
     }
 }