View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: IDataImporter.java
13   * Created: 2007-00-00
14   * Author: entrop
15   * $Id: IDataImporter.java 2256 2009-01-07 16:23:10Z bmilos $
16   */
17  
18  package pl.edu.agh.cast.data.importer.data;
19  
20  import java.io.IOException;
21  import java.io.InputStream;
22  import java.nio.charset.Charset;
23  import java.util.Map;
24  
25  import pl.edu.agh.cast.rawdata.TabularData;
26  
27  /**
28   * Interface for all data importer classes.
29   *
30   * @author AGH CAST Team
31   */
32  public interface IDataImporter {
33  	/**
34  	 * Transforms the data provided in dataInputStream into TabularData.
35  	 *
36  	 * @param dataIS
37  	 *            The data input stream to be transformed
38  	 * @param rowsLimit
39  	 *            Maximum number of rows which would be imported
40  	 * @param options
41  	 *            Options passed to data importer
42  	 * @param charset
43  	 *            Encoding of data contained in input stream
44  	 * @return Transformed data.
45  	 * @throws IOException
46  	 */
47  	public TabularData readData(InputStream dataIS, long rowsLimit, Map<String, String> options, Charset charset)
48  	    throws IOException;
49  
50  	/**
51  	 * Retrieves the importer options.
52  	 *
53  	 * @return importer options.
54  	 */
55  	public Map<String, String> getOptions();
56  
57  	/**
58  	 * Validate if importer is good.
59  	 *
60  	 * @param dataIs
61  	 *            The data input stream to be transformed
62  	 * @param options
63  	 *            Options passed to data importer
64  	 * @return <code>true</code> is the importer is valid; <code>false</code> otherwise
65  	 */
66  	public boolean validate(InputStream dataIs, Map<String, String> options);
67  }