List of usage examples for java.util.zip DataFormatException DataFormatException
public DataFormatException(String s)
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Retrieves the features of a specified data set. * /*from www . j a v a2 s.co m*/ * @param did * - The data_id of the data features to download. * @return DataFeatures - An object containing the features of the data * @throws Exception * - Can be: API Error (see documentation at openml.org), server * down, etc. */ public DataFeature dataFeatures(int did) throws Exception { Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "data/features/" + did, getApiKey(), verboseLevel); if (apiResult instanceof DataFeature) { return (DataFeature) apiResult; } else { throw new DataFormatException("Casting Api Object to DataFeature"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
public Data dataList(String tag) throws Exception { Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "data/list/tag/" + tag, getApiKey(), verboseLevel);// ww w.jav a 2 s. co m if (apiResult instanceof Data) { return (Data) apiResult; } else { throw new DataFormatException("Casting Api Object to Data"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Retrieves the qualities (meta-features) of a specified data set. * //from w ww . ja va2 s . c o m * @param did * - The data_id of the data features to download. * @return DataFeatures - An object containing the qualities of the data * @throws Exception * - Can be: API Error (see documentation at openml.org), server * down, etc. */ public DataQuality dataQualities(int did) throws Exception { Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "data/qualities/" + did, getApiKey(), verboseLevel); if (apiResult instanceof DataQuality) { return (DataQuality) apiResult; } else { throw new DataFormatException("Casting Api Object to DataQuality"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Uploads data features (requires admin account) * // w w w .jav a 2s . c o m * @param description - the features * @return * @throws Exception */ public DataFeatureUpload dataFeaturesUpload(File description) throws Exception { MultipartEntity params = new MultipartEntity(); params.addPart("description", new FileBody(description)); if (verboseLevel >= Constants.VERBOSE_LEVEL_ARFF) { System.out.println(Conversion.fileToString(description) + "\n==========\n"); } Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "data/features", params, getApiKey(), verboseLevel); if (apiResult instanceof DataFeatureUpload) { return (DataFeatureUpload) apiResult; } else { throw new DataFormatException("Casting Api Object to DataFeatureUpload"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Uploads data qualities (requires admin account) * // w ww. j a v a2s . c om * @param description - the qualitues (or meta-features) * @return * @throws Exception */ public DataQualityUpload dataQualitiesUpload(File description) throws Exception { MultipartEntity params = new MultipartEntity(); params.addPart("description", new FileBody(description)); Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "data/qualities", params, getApiKey(), verboseLevel); if (apiResult instanceof DataQualityUpload) { return (DataQualityUpload) apiResult; } else { throw new DataFormatException("Casting Api Object to DataQualityUpload"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Returns a list with all available data qualities. * /*from w ww . j ava 2 s . c o m*/ * @return * @throws Exception */ public DataQualityList dataQualitiesList() throws Exception { Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "data/qualities/list", getApiKey(), verboseLevel); if (apiResult instanceof DataQualityList) { return (DataQualityList) apiResult; } else { throw new DataFormatException("Casting Api Object to DataQualityList"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * @param task_id/*from w w w . j a v a2 s . c om*/ * - The numeric id of the task to be obtained. * @return Task - An object describing the task * @throws Exception * - Can be: API Error (see documentation at openml.org), server * down, etc. */ public Task taskGet(int task_id) throws Exception { if (Caching.in_cache("task", task_id, "xml") || Settings.LOCAL_OPERATIONS) { String taskXml = Conversion.fileToString(Caching.cached("task", task_id, "xml")); return (Task) HttpConnector.xstreamClient.fromXML(taskXml); } Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "task/" + task_id, getApiKey(), verboseLevel); if (apiResult instanceof Task) { if (Settings.CACHE_ALLOWED) { try { Caching.cache(apiResult, "task", task_id, "xml"); } catch (IOException e) { Conversion.log("Warning", "TaskGet", "Cache Store Exception: " + e.getMessage()); } } return (Task) apiResult; } else { throw new DataFormatException("Casting Api Object to Task"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
public Tasks taskList(String tag) throws Exception { Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "task/list/tag/" + tag, getApiKey(), verboseLevel);/*ww w.ja va 2s . co m*/ if (apiResult instanceof Tasks) { return (Tasks) apiResult; } else { throw new DataFormatException("Casting Api Object to Tasks"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Deletes a task/*from ww w . j a va 2 s . c o m*/ * * @param task_id - the task to be deleted * @return * @throws Exception */ public TaskDelete taskDelete(int task_id) throws Exception { Object apiResult = HttpConnector.doApiDelete(OPENML_URL + API_PART + "task/" + task_id, getApiKey(), verboseLevel); if (apiResult instanceof TaskDelete) { return (TaskDelete) apiResult; } else { throw new DataFormatException("Casting Api Object to TaskDelete"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Uploads a task// w w w . j av a 2s .co m * * @param description - task description. * @return * @throws Exception */ public UploadTask taskUpload(File description) throws Exception { MultipartEntity params = new MultipartEntity(); params.addPart("description", new FileBody(description)); Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "task/", params, getApiKey(), verboseLevel); if (apiResult instanceof UploadTask) { return (UploadTask) apiResult; } else { throw new DataFormatException("Casting Api Object to UploadTask"); } }