Example #1
0
 private void readValues(boolean ignoreEof) throws IOException {
   int control = input.read();
   if (control == -1) {
     if (!ignoreEof) {
       throw new EOFException("Read past end of RLE integer from " + input);
     }
     used = numLiterals = 0;
     return;
   } else if (control < 0x80) {
     numLiterals = control + RunLengthIntegerWriter.MIN_REPEAT_SIZE;
     used = 0;
     repeat = true;
     delta = input.read();
     if (delta == -1) {
       throw new EOFException("End of stream in RLE Integer from " + input);
     }
     // convert from 0 to 255 to -128 to 127 by converting to a signed byte
     delta = (byte) (0 + delta);
     if (signed) {
       literals[0] = utils.readVslong(input);
     } else {
       literals[0] = utils.readVulong(input);
     }
   } else {
     repeat = false;
     numLiterals = 0x100 - control;
     used = 0;
     for (int i = 0; i < numLiterals; ++i) {
       if (signed) {
         literals[i] = utils.readVslong(input);
       } else {
         literals[i] = utils.readVulong(input);
       }
     }
   }
 }