Пример #1
0
  /*
   * (non-Javadoc)
   *
   * @see hdt.triples.array.Stream#load(java.io.InputStream)
   */
  @Override
  public void load(InputStream input, ProgressListener listener) throws IOException {
    int type = input.read();
    if (type != SequenceFactory.TYPE_SEQ32) {
      throw new IllegalFormatException("Trying to read INT32 but data is not INT32");
    }

    int size = IOUtil.readInt(input);
    if (size < 0) {
      throw new IOException("Cannot load values bigger than 2Gb with this data structure");
    }

    numelements = 0;
    data = new int[size];

    for (long i = 0; i < size; i++) {
      append(IOUtil.readInt(input));
    }
  }