예제 #1
0
  /**
   * Retrieves the LDIF reader configured to read from the next LDIF file in the list.
   *
   * @return The reader that should be used to read the LDIF data, or <CODE>null</CODE> if there are
   *     no more files to read.
   * @throws IOException If a problem occurs while obtaining the reader.
   */
  public BufferedReader nextReader() throws IOException {
    if (ldifFileIterator == null || !ldifFileIterator.hasNext()) {
      return null;
    }

    reader.close();

    InputStream inputStream = ldifInputStream = new FileInputStream(ldifFileIterator.next());

    if (isEncrypted) {
      // FIXME -- Add support for encryption with a cipher input stream.
    }

    if (isCompressed) {
      inputStream = new GZIPInputStream(inputStream);
    }

    reader = new BufferedReader(new InputStreamReader(inputStream), bufferSize);
    return reader;
  }
예제 #2
0
  /**
   * Retrieves the reader that should be used to read the LDIF data. Note that if the LDIF file is
   * compressed and/or encrypted, then that must be indicated before this method is called for the
   * first time.
   *
   * @return The reader that should be used to read the LDIF data.
   * @throws IOException If a problem occurs while obtaining the reader.
   */
  public BufferedReader getReader() throws IOException {
    if (reader == null) {
      InputStream inputStream;
      if (ldifInputStream != null) {
        inputStream = ldifInputStream;
      } else {
        inputStream = ldifInputStream = new FileInputStream(ldifFileIterator.next());
      }

      if (isEncrypted) {
        // FIXME -- Add support for encryption with a cipher input
        //          stream.
      }

      if (isCompressed) {
        inputStream = new GZIPInputStream(inputStream);
      }

      reader = new BufferedReader(new InputStreamReader(inputStream), bufferSize);
    }

    return reader;
  }