package org.gbif.dwc;

import java.io.IOException;
import java.nio.file.Path;

/**
 * Collections of static methods to work with Darwin Core (archive) files.
 *
 * TODO: methods without validation, probably for use with the validator.
 */
public class DwcFiles {

  /**
   * Collections of static methods, no constructors.
   */
  private DwcFiles() {
  }

  /**
   * Build a Darwin Core {@link Archive} from a location. The location can be an uncompressed directory or an uncompressed file.
   *
   * @param dwcLocation the location of an expanded Darwin Core Archive directory, or a single Darwin Core text file
   *
   * @return new {@link Archive}, never null. But, the {@link Archive} can be empty (e.g. no core)
   */
  public static Archive fromLocation(Path dwcLocation) throws IOException, UnsupportedArchiveException {
    // delegate to InternalDwcFileFactory
    Archive archive = InternalDwcFileFactory.fromLocation(dwcLocation);
    archive.validate();
    return archive;
  }

  /**
   * Build an {@link Archive} from a compressed file. The compressed file will be extracted in the provided directory.
   * The supported compressions are zip and gzip.
   *
   * @param dwcaLocation the location of a compressed Darwin Core Archive
   * @param destination  the destination of the uncompressed content.
   *
   * @return new {@link Archive}, never null. But, the {@link Archive} can be empty (e.g. no core)
   *
   * @throws IOException
   * @throws UnsupportedArchiveException
   */
  public static Archive fromCompressed(Path dwcaLocation, Path destination) throws IOException, UnsupportedArchiveException {
    // delegate to InternalDwcFileFactory
    Archive archive = InternalDwcFileFactory.fromCompressed(dwcaLocation, destination);
    archive.validate();
    return archive;
  }
}

@@ -981,24 +981,728 @@
 chive;%0A  %7D%0A%0A
+  /**%0A   * Build a Darwin Core %7B@link Archive%7D from a location. The location can be an uncompressed directory or an uncompressed file.%0A   *%0A   * This method skips basic validation, and should only be used by a tool that does its own validation.%0A   *%0A   * @param dwcLocation the location of an expanded Darwin Core Archive directory, or a single Darwin Core text file%0A   *%0A   * @return new %7B@link Archive%7D, never null. But, the %7B@link Archive%7D can be empty (e.g. no core)%0A   */%0A  public static Archive fromLocationSkipValidation(Path dwcLocation) throws IOException, UnsupportedArchiveException %7B%0A    // delegate to InternalDwcFileFactory%0A    return InternalDwcFileFactory.fromLocation(dwcLocation);%0A  %7D%0A%0A
   /**%0A   * B

Add method to skip validation, for use by the validator.