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  
19  import java.io.File;
20  import java.io.FileInputStream;
21  import java.io.IOException;
22  import java.io.InputStream;
23  
24  
25  /** Provider for data files in an explicit list.
26   * <p>
27   * Zip archives entries are supported recursively.
28   * </p>
29   * <p>
30   * This is a simple application of the <code>visitor</code> design pattern for
31   * list browsing.
32   * </p>
33   * @see DataProvidersManager
34   * @since 10.1
35   * @author Luc Maisonobe
36   */
37  public class FilesListCrawler extends AbstractListCrawler<File> {
38  
39      /** Build a data classpath crawler.
40       * <p>The default timeout is set to 10 seconds.</p>
41       * @param inputs list of input files
42       */
43      public FilesListCrawler(final File... inputs) {
44          super(inputs);
45      }
46  
47      /** {@inheritDoc} */
48      @Override
49      protected String getCompleteName(final File input) {
50          return input.getPath();
51      }
52  
53      /** {@inheritDoc} */
54      @Override
55      protected String getBaseName(final File input) {
56          return input.getName();
57      }
58  
59      /** {@inheritDoc} */
60      @Override
61      protected ZipJarCrawler getZipJarCrawler(final File input) {
62          return new ZipJarCrawler(input);
63      }
64  
65      /** {@inheritDoc} */
66      @Override
67      protected InputStream getStream(final File input) throws IOException {
68          return new FileInputStream(input);
69      }
70  
71  }