Пример #1
0
  protected final void doClose() throws IOException {
    fieldsReader.close();
    tis.close();

    if (freqStream != null) freqStream.close();
    if (proxStream != null) proxStream.close();

    closeNorms();
    if (termVectorsReader != null) termVectorsReader.close();

    if (cfsReader != null) cfsReader.close();
  }
Пример #2
0
  /** Read norms into a pre-allocated array. */
  public synchronized void norms(String field, byte[] bytes, int offset) throws IOException {

    Norm norm = (Norm) norms.get(field);
    if (norm == null) return; // use zeros in array

    if (norm.bytes != null) { // can copy from cache
      System.arraycopy(norm.bytes, 0, bytes, offset, maxDoc());
      return;
    }

    InputStream normStream = (InputStream) norm.in.clone();
    try { // read from disk
      normStream.seek(0);
      normStream.readBytes(bytes, offset, maxDoc());
    } finally {
      normStream.close();
    }
  }