當前位置: 首頁>>代碼示例>>Java>>正文


Java IOUtil.isURIAvailable方法代碼示例

本文整理匯總了Java中org.databene.commons.IOUtil.isURIAvailable方法的典型用法代碼示例。如果您正苦於以下問題:Java IOUtil.isURIAvailable方法的具體用法?Java IOUtil.isURIAvailable怎麽用?Java IOUtil.isURIAvailable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.databene.commons.IOUtil的用法示例。


在下文中一共展示了IOUtil.isURIAvailable方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: environmentFileName

import org.databene.commons.IOUtil; //導入方法依賴的package包/類
public static String environmentFileName(String environment) throws IOException {
	String filename = environment + ".env.properties";
	File file = FileUtil.getFileIgnoreCase(new File(filename), false);
	if (!file.exists()) {
		File defaultUserHomeFile = new File(SystemInfo.getUserHome() + SystemInfo.getFileSeparator() + "databene", filename);
		file = FileUtil.getFileIgnoreCase(defaultUserHomeFile, false);
	}
	String path;
	if (file.exists()) {
		path = file.getCanonicalPath();
	} else if (IOUtil.isURIAvailable(filename)) {
		path = filename;
	} else {
		throw new ConfigurationError("No environment definition '" + filename + "' found");
	}
	return path;
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:18,代碼來源:DBUtil.java

示例2: importStates

import org.databene.commons.IOUtil; //導入方法依賴的package包/類
private void importStates() {
      this.states = new OrderedNameMap<State>();
      String filename = "/org/databene/domain/address/state_" + isoCode + ".csv";
      if (!IOUtil.isURIAvailable(filename)) {
      	LOGGER.debug("No states defined for {}", this);
      	return;
      }
ComplexTypeDescriptor stateDescriptor = (ComplexTypeDescriptor) new BeanDescriptorProvider().getTypeDescriptor(State.class.getName());
CSVEntitySource source = new CSVEntitySource(filename, stateDescriptor, Encodings.UTF_8);
source.setContext(new DefaultBeneratorContext());
      DataIterator<Entity> iterator = source.iterator();
      DataContainer<Entity> container = new DataContainer<Entity>();
      while ((container = iterator.next(container)) != null) {
      	Entity entity = container.getData();
      	State state = new State();
      	mapProperty("id", entity, state, true);
      	mapProperty("name", entity, state, true);
      	mapProperty("defaultLanguage", entity, state, false);
      	state.setCountry(this);
      	addState(state);
      }
      IOUtil.close(iterator);
  }
 
開發者ID:raphaelfeng,項目名稱:benerator,代碼行數:24,代碼來源:Country.java

示例3: FemaleFamilyNameConverter

import org.databene.commons.IOUtil; //導入方法依賴的package包/類
public FemaleFamilyNameConverter(String datasetName) {
 super(String.class, String.class);
 ArrayBuilder<String[]> builder = new ArrayBuilder<String[]>(String[].class);
 try {
  if (datasetName != null) {
   String dataFileName = DatasetUtil.filenameOfDataset(datasetName, 
   		"/org/databene/domain/person/ffn_{0}.properties");
  	if (IOUtil.isURIAvailable(dataFileName)) {
   	Map<String, String> props = IOUtil.readProperties(dataFileName);
   	for (Map.Entry<String, String> entry : props.entrySet())
   		builder.add(new String[] { entry.getKey(), entry.getValue() });
  	}
  }
 } catch (Exception e) {
 	logger.debug("No female family name conversion defined for dataset '" + datasetName + "'");
 }
 this.mappings = builder.toArray();
}
 
開發者ID:raphaelfeng,項目名稱:benerator,代碼行數:19,代碼來源:FemaleFamilyNameConverter.java

示例4: parseReservedWordsConfigFile

import org.databene.commons.IOUtil; //導入方法依賴的package包/類
private void parseReservedWordsConfigFile() {
	String resourceName = "org/databene/jdbacl/dialect/" + system + "-reserved_words.txt";
	if (IOUtil.isURIAvailable(resourceName)) {
		parseReservedWords(resourceName);
	} else {
		logger.debug("Configuration file not found: " + resourceName + ". Falling back to SQL:2003 keywords");
		parseReservedWords("org/databene/jdbacl/dialect/SQL2003-reserved_words.txt");
	}
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:10,代碼來源:DatabaseDialect.java

示例5: CSVEntityIterator

import org.databene.commons.IOUtil; //導入方法依賴的package包/類
public CSVEntityIterator(String uri, ComplexTypeDescriptor descriptor, Converter<String, ?> preprocessor, char separator, String encoding) throws FileNotFoundException {
	if (!IOUtil.isURIAvailable(uri))
		throw new FileNotFoundException("URI not found: " + uri);
    this.uri = uri;
    this.preprocessor = preprocessor;
    this.separator = separator;
    this.encoding = encoding;
    this.entityDescriptor = descriptor;
    this.initialized = false;
    this.expectingHeader = true;
    this.rowBased = (descriptor != null && descriptor.isRowBased() != null ? descriptor.isRowBased() : true);
}
 
開發者ID:raphaelfeng,項目名稱:benerator,代碼行數:13,代碼來源:CSVEntityIterator.java

示例6: initPrinter

import org.databene.commons.IOUtil; //導入方法依賴的package包/類
protected void initPrinter(Object data) throws IOException {
    if (uri == null)
        throw new ConfigurationError("Property 'uri' not set on bean " + getClass().getName());
    wasAppended = (append && IOUtil.isURIAvailable(uri));
    printer = IOUtil.getPrinterForURI(uri, encoding, append, lineSeparator, true);
    postInitPrinter(data);
}
 
開發者ID:raphaelfeng,項目名稱:benerator,代碼行數:8,代碼來源:TextFileExporter.java

示例7: init

import org.databene.commons.IOUtil; //導入方法依賴的package包/類
private static void init() {
if (IOUtil.isURIAvailable(FILENAME)) {
       try {
   	    Map<String, String> values = IOUtil.readProperties(FILENAME);
           for (Map.Entry<String, String> entry : values.entrySet())
           	MAP.put(entry.getKey(), new IncrementalIdGenerator(Long.parseLong(entry.getValue())));
          } catch (Exception e) {
          	throw new ConfigurationError(e);
          }
}
  }
 
開發者ID:raphaelfeng,項目名稱:benerator,代碼行數:12,代碼來源:LocalSequenceGenerator.java

示例8: createGeneratorForAtomicDataset

import org.databene.commons.IOUtil; //導入方法依賴的package包/類
@Override
protected WeightedGenerator<E> createGeneratorForAtomicDataset(Dataset dataset) {
	String filename = DatasetUtil.filenameOfDataset(dataset.getName(), filenamePattern);
	LOGGER.debug("Creating weighted data set CSV generator for file {}", filename);
	if (IOUtil.isURIAvailable(filename)) {
		List<WeightedSample<E>> samples = CSVGeneratorUtil.parseFile(filename, separator, encoding, converter);
		AttachedWeightSampleGenerator<E> generator = new AttachedWeightSampleGenerator<E>(generatedType);
		for (WeightedSample<E> sample : samples)
			generator.addSample(sample.getValue(), sample.getWeight());
		if (samples.size() > 0)
			return new AtomicDatasetGenerator<E>(generator, filename, dataset.getName());
	}
	return null;
}
 
開發者ID:raphaelfeng,項目名稱:benerator,代碼行數:15,代碼來源:WeightedDatasetCSVGenerator.java


注:本文中的org.databene.commons.IOUtil.isURIAvailable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。