1   /* Copyright 2002-2019 CS Systèmes d'Information
2    * Licensed to CS Systèmes d'Information (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.IOException;
20  import java.io.InputStream;
21  import java.text.ParseException;
22  
23  /** Interface for loading data files from {@link DataProvider data providers}.
24   * @see DataProvider
25   * @author Luc Maisonobe
26   */
27  public interface DataLoader {
28  
29      /** Check if the loader still accepts new data.
30       * <p>
31       * This method is used to speed up data loading by interrupting crawling
32       * the data sets as soon as a loader has found the data it was waiting for.
33       * For loaders that can merge data from any number of sources (for example
34       * JPL ephemerides or Earth Orientation Parameters that are split among
35       * several files), this method should always return true to make sure no
36       * data is left over.
37       * </p>
38       * @return true while the loader still accepts new data
39       */
40      boolean stillAcceptsData();
41  
42      /** Load data from a stream.
43       * @param input data input stream
44       * @param name name of the file (or zip entry)
45       * @exception IOException if data can't be read
46       * @exception ParseException if data can't be parsed
47       * or if some loader specific error occurs
48       */
49      void loadData(InputStream input, String name)
50          throws IOException, ParseException;
51  
52  }