code: public void setByteLimit(int bytes)
      {
          _byteLimit=bytes;
          
          if (bytes>=0)
          {
              _newByteLimit=true;
              _byteLimit-=_contents-_pos;
              if (_byteLimit<0)
              {
                  _avail+=_byteLimit;
                  _byteLimit=0;
              }
          }
          else
          {
              _newByteLimit=false;
              _avail=_contents;
              _eof=false;
          }
      }
docs: Set the byte limit.
  If set, only this number of bytes are read before EOF.
  @param bytes Limit number of bytes, or -1 for no limit.