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