public void load(DataResource resource) throws ResourceInitializationException { try { model = loadModel(resource.getInputStream()); } catch (IOException e) { throw new ResourceInitializationException( ExceptionMessages.MESSAGE_CATALOG, ExceptionMessages.IO_ERROR_MODEL_READING, new Object[] { e.getMessage()}, e); } } }
public InputStream getInputStream() throws IOException { return new BufferedInputStream(dataResource.getInputStream()); }
public void load(DataResource data) throws ResourceInitializationException { if (data != null) { try { InputStream inputStream = data.getInputStream(); this.model = null; ObjectInputStream p = new ObjectInputStream(inputStream); this.model = (ModelGeneration) p.readObject(); p.close(); } catch (IOException e) { throw new ResourceInitializationException(e); } catch (ClassNotFoundException e) { throw new ResourceInitializationException(e); } } }
@Override public void load(DataResource data) throws ResourceInitializationException { try { this.doLoad(data.getInputStream()); } catch (Exception e) { throw new ResourceInitializationException(e); } }
@SuppressWarnings("unchecked") public void load(DataResource data) throws ResourceInitializationException { try { InputStream iStream = data.getInputStream(); BufferedInputStream bis = new BufferedInputStream(iStream); ObjectInputStream ois = new ObjectInputStream(bis); entryPropertiesRoot = (EntryPropertiesRoot) ois.readObject(); dictImpl = (Hashtable) ois.readObject(); ois.close(); } catch (IOException e) { throw new ResourceInitializationException(e); } catch (ClassNotFoundException e) { throw new ResourceInitializationException(e); } }
@Override public void load(DataResource dataRes) throws ResourceInitializationException { try (InputStream is = dataRes.getInputStream()) { load(is); } catch (IOException e) { throw new ResourceInitializationException(e); } }
public void load(DataResource resource) throws ResourceInitializationException { try { model = loadModel(resource.getInputStream()); } catch (IOException e) { throw new ResourceInitializationException( ExceptionMessages.MESSAGE_CATALOG, ExceptionMessages.IO_ERROR_MODEL_READING, new Object[] { e.getMessage()}, e); } } }
@Override public void load(DataResource data) throws ResourceInitializationException { try { this.load(data.getInputStream()); } catch (IOException e) { throw new ResourceInitializationException(e); } }
@SuppressWarnings("unchecked") @Override public void load(DataResource dr) throws ResourceInitializationException { DefaultWordformStore<TagType> ws; try { ws = (DefaultWordformStore<TagType>) SerializationUtils.deserialize( new BufferedInputStream(dr.getInputStream())); } catch (IOException e) { throw new ResourceInitializationException(e); } this.strKeyMap = ws.strKeyMap; this.metadataMap = ws.metadataMap; }
@Override public void load(DataResource dr) throws ResourceInitializationException { try { gramModel = GramModelDeserializer .from(dr.getInputStream(), String.valueOf(dr.getUrl())); } catch (Exception e) { throw new ResourceInitializationException(e); } }
try InputStream inStream = dr.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(inStream)); int lineCount = 0;
private InputStream getResourceAsStreamCommon(Object resource) throws ResourceAccessException { checkDestroyed(); try { if (resource != null && resource instanceof DataResource) { return ((DataResource) resource).getInputStream(); } else { return null; } } catch (IOException e) { throw new ResourceAccessException(e); } }
try InputStream inStream = dr.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(inStream)); int lineCount = 0;
InputStream inputStream = null; try { inputStream = data.getInputStream(); Scanner scanner = null; try {
/** * {@inheritDoc} */ @Override public void load(DataResource dr) throws ResourceInitializationException { if (this.dict != null) { throw new IllegalStateException( "Repeated SharedResourceObjectInvocation#load invocation"); } URL resUrl = dr.getUrl(); try { CachedDictionaryDeserializer deser = CachedDictionaryDeserializer.getInstance(); GetDictionaryResult deserResult = deser.getDictionary(resUrl, dr.getInputStream()); this.cacheKey = deserResult.cacheKey; this.dict = deserResult.dictionary; } catch (Exception e) { throw new ResourceInitializationException(e); } }
/** * {@inheritDoc} */ @Override public void load(DataResource dr) throws ResourceInitializationException { ConfigurationParameterInitializer.initialize(this, dr); try { dict = DictionaryDeserializer.from(dr.getInputStream(), String.valueOf(dr.getUrl())); if (wfPredictorClassName != null) { @SuppressWarnings("unchecked") Class<? extends WordformPredictor> wfPredictorClass = (Class<? extends WordformPredictor>) Class.forName(wfPredictorClassName); WordformPredictor wfPredictor = makePredictor(wfPredictorClass); ((MorphDictionaryImpl) dict).setWfPredictor(wfPredictor); log.info("{} was set in deserialized MorphDictionary", wfPredictor.getClass().getSimpleName()); } else { log.info("A wordform predictor has not been set in deserialized MorphDictionary"); } } catch (Exception e) { throw new ResourceInitializationException(e); } }
@Override public void load(DataResource aData) throws ResourceInitializationException { ConfigurationParameterInitializer.initialize(this, aData); try { InputStream fileIn = aData.getInputStream(); ObjectInputStream in = new ObjectInputStream(fileIn); WekaSerializedModel model = (WekaSerializedModel) in.readObject(); in.close(); fileIn.close(); this.attributes = model.getAttributes(); this.bipartitionThreshold = model.getBipartitionThreshold(); this.editFeatureExtractors = model.getEditFeatureExtractors(); this.allClassLabels = model.getAllClassLabels(); this.pipelineParameters = model.getPipelineParameters(); this.trainedClassifier = model.getTrainedClassifier(); this.metaFiles = model.getMetaFiles(); } catch (Exception e) { throw new ResourceInitializationException(e); } }
@Override public void load(DataResource aData) throws ResourceInitializationException { ConfigurationParameterInitializer.initialize(this, aData); try (InputStream fileIn = aData.getInputStream(); ObjectInputStream in = new ObjectInputStream(fileIn);) { WekaSerializedModel model = (WekaSerializedModel) in.readObject(); in.close(); fileIn.close(); this.attributes = model.getAttributes(); this.bipartitionThreshold = model.getBipartitionThreshold(); this.editFeatureExtractors = model.getEditFeatureExtractors(); this.allClassLabels = model.getAllClassLabels(); this.pipelineParameters = model.getPipelineParameters(); this.trainedClassifier = model.getTrainedClassifier(); this.metaFiles = model.getMetaFiles(); } catch (Exception e) { throw new ResourceInitializationException(e); } }
@Override public void load(DataResource aData) throws ResourceInitializationException { ConfigurationParameterInitializer.initialize(this, aData); try { InputStream fileIn = aData.getInputStream(); ObjectInputStream in = new ObjectInputStream(fileIn); WekaSerializedModel model = (WekaSerializedModel) in.readObject(); in.close(); fileIn.close(); this.attributes = model.getAttributes(); this.bipartitionThreshold = model.getBipartitionThreshold(); this.editFeatureExtractors = model.getEditFeatureExtractors(); this.allClassLabels = model.getAllClassLabels(); this.pipelineParameters = model.getPipelineParameters(); this.trainedClassifier = model.getTrainedClassifier(); this.metaFiles = model.getMetaFiles(); } catch (Exception e) { throw new ResourceInitializationException(e); } }
@Override public void load(DataResource aData) throws ResourceInitializationException { CharStream input; try { UIMAFramework.getLogger().log(Level.FINE, "Loading resource " + KEY_TOKEN_REGEX_RULES + " at: " + aData.getUri()); input = CharStreams.fromStream(aData.getInputStream()); UimaTokenRegexLexer lexer = new UimaTokenRegexLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); UimaTokenRegexParser parser = new UimaTokenRegexParser(tokens); listener = new AutomataParserListener( parser ); listener.setAllowMatchingEmptySequences(false); ParseTreeWalker.DEFAULT.walk(listener, parser.ruleList()); } catch (IOException e) { throw new ResourceInitializationException(e); } }