FilesListCrawler.java

  1. /* Copyright 2002-2025 CS GROUP
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.data;

  18. import java.io.File;
  19. import java.io.FileInputStream;
  20. import java.io.IOException;
  21. import java.io.InputStream;


  22. /** Provider for data files in an explicit list.
  23.  * <p>
  24.  * Zip archives entries are supported recursively.
  25.  * </p>
  26.  * <p>
  27.  * This is a simple application of the <code>visitor</code> design pattern for
  28.  * list browsing.
  29.  * </p>
  30.  * @see DataProvidersManager
  31.  * @since 10.1
  32.  * @author Luc Maisonobe
  33.  */
  34. public class FilesListCrawler extends AbstractListCrawler<File> {

  35.     /** Build a data classpath crawler.
  36.      * <p>The default timeout is set to 10 seconds.</p>
  37.      * @param inputs list of input files
  38.      */
  39.     public FilesListCrawler(final File... inputs) {
  40.         super(inputs);
  41.     }

  42.     /** {@inheritDoc} */
  43.     @Override
  44.     protected String getCompleteName(final File input) {
  45.         return input.getPath();
  46.     }

  47.     /** {@inheritDoc} */
  48.     @Override
  49.     protected String getBaseName(final File input) {
  50.         return input.getName();
  51.     }

  52.     /** {@inheritDoc} */
  53.     @Override
  54.     protected ZipJarCrawler getZipJarCrawler(final File input) {
  55.         return new ZipJarCrawler(input);
  56.     }

  57.     /** {@inheritDoc} */
  58.     @Override
  59.     protected InputStream getStream(final File input) throws IOException {
  60.         return new FileInputStream(input);
  61.     }

  62. }