Exemplo n.º 1
0
        private void readValues(bool ignoreEof)
        {
            // read the first 2 bits and determine the encoding type
            isRepeating = false;
            int firstByte = input.ReadByte();

            if (firstByte < 0)
            {
                if (!ignoreEof)
                {
                    throw new EndOfStreamException("Read past end of RLE integer from " + input);
                }
                used = numLiterals = 0;
                return;
            }
            currentEncoding = encodings[(firstByte >> 6) & 0x03];
            switch (currentEncoding)
            {
            case RunLengthIntegerWriterV2.EncodingType.SHORT_REPEAT:
                readShortRepeatValues(firstByte);
                break;

            case RunLengthIntegerWriterV2.EncodingType.DIRECT:
                readDirectValues(firstByte);
                break;

            case RunLengthIntegerWriterV2.EncodingType.PATCHED_BASE:
                readPatchedBaseValues(firstByte);
                break;

            case RunLengthIntegerWriterV2.EncodingType.DELTA:
                readDeltaValues(firstByte);
                break;

            default: throw new IOException("Unknown encoding " + currentEncoding);
            }
        }
 private void readValues(bool ignoreEof)
 {
     // read the first 2 bits and determine the encoding type
     isRepeating = false;
     int firstByte = input.ReadByte();
     if (firstByte < 0)
     {
         if (!ignoreEof)
         {
             throw new EndOfStreamException("Read past end of RLE integer from " + input);
         }
         used = numLiterals = 0;
         return;
     }
     currentEncoding = encodings[(firstByte >> 6) & 0x03];
     switch (currentEncoding)
     {
         case RunLengthIntegerWriterV2.EncodingType.SHORT_REPEAT:
             readShortRepeatValues(firstByte);
             break;
         case RunLengthIntegerWriterV2.EncodingType.DIRECT:
             readDirectValues(firstByte);
             break;
         case RunLengthIntegerWriterV2.EncodingType.PATCHED_BASE:
             readPatchedBaseValues(firstByte);
             break;
         case RunLengthIntegerWriterV2.EncodingType.DELTA:
             readDeltaValues(firstByte);
             break;
         default: throw new IOException("Unknown encoding " + currentEncoding);
     }
 }