当前位置: 首页>>代码示例>>Java>>正文


Java SystemInfo.getLineSeparator方法代码示例

本文整理汇总了Java中org.databene.commons.SystemInfo.getLineSeparator方法的典型用法代码示例。如果您正苦于以下问题:Java SystemInfo.getLineSeparator方法的具体用法?Java SystemInfo.getLineSeparator怎么用?Java SystemInfo.getLineSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.databene.commons.SystemInfo的用法示例。


在下文中一共展示了SystemInfo.getLineSeparator方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertInterchangesMatch

import org.databene.commons.SystemInfo; //导入方法依赖的package包/类
/** Asserts that two EDIFACT or X12 interchanges are equal.
 * @throws FunctionalFailure if they are not equal. */
@Override
public void assertInterchangesMatch(String elementType, String elementName,
        Interchange expected, Interchange actual,
        EdiComparisonSettings settings) {
    AggregateEdiDiff diffs = contentHandler.compare(expected, actual, settings);
    memorizeInterchanges(expected, actual, diffs);
    int detailCount = diffs.getEdiDetails().size();
    if (detailCount > 0) {
        String lf = SystemInfo.getLineSeparator();
        StringBuilder message = new StringBuilder("Interchanges do not match. Found " + detailCount + " difference");
        if (detailCount > 1) {
            message.append("s");
        }
        for (EdiDiffDetail diff : diffs.getEdiDetails()) {
            message.append(lf).append(diff);
        }
        throw new FunctionalFailure(message.toString());
    }
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:22,代码来源:EdifattoFileAction.java

示例2: createBeneratorXml

import org.databene.commons.SystemInfo; //导入方法依赖的package包/类
public void createBeneratorXml() throws IOException, ParseException {
 	File descriptorFile = new File(setup.getProjectFolder(), "benerator.xml");
 	if (descriptorFile.exists()) { // not applicable for XML schema based generation
  	BufferedReader reader = IOUtil.getReaderForURI(descriptorFile.getAbsolutePath());
DefaultHTMLTokenizer tokenizer = new DefaultHTMLTokenizer(reader);
  	String lineSeparator = setup.getLineSeparator();
  	if (StringUtil.isEmpty(lineSeparator))
  		lineSeparator = SystemInfo.getLineSeparator();
LFNormalizingStringBuilder writer = new LFNormalizingStringBuilder(lineSeparator);
  	while (tokenizer.nextToken() != HTMLTokenizer.END)
  		processToken(setup, tokenizer, writer);
  	String xml = writer.toString();
  	xml = resolveVariables(xml);
IOUtil.writeTextFile(descriptorFile.getAbsolutePath(), xml, "UTF-8");
 	}
 	monitor.advance();
 }
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:18,代码来源:ProjectBuilder.java

示例3: testGetGenerator

import org.databene.commons.SystemInfo; //导入方法依赖的package包/类
@Test
public void testGetGenerator() throws Exception {
	String lf = SystemInfo.getLineSeparator();
	String uri = "string://<setup>" + lf +
			"	<generate name='perGen' type='Person' count='3'>" + lf +
			"		<id name='id' type='int'/>" + lf +
			"		<attribute name='name' constant='Alice'/>" + lf +
			"	</generate>" + lf +
			"</setup>";
	context.setValidate(false);
	Generator<?> generator = new DescriptorBasedGenerator(uri, "perGen", context);
	assertEquals(Object.class, generator.getGeneratedType());
	assertNotNull(generator);
	generator.init(context);
	for (int i = 0; i < 3; i++)
		checkGeneration((Entity) GeneratorUtil.generateNonNull(generator), i + 1);
	assertUnavailable(generator);
	generator.close();
}
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:20,代码来源:DescriptorBasedGeneratorTest.java

示例4: writeInterchange

import org.databene.commons.SystemInfo; //导入方法依赖的package包/类
/** Writes an EDIFACT or X12 interchange to an {@link OutputStream}. */
@Override
public void writeInterchange(Interchange interchange, OutputStream out, boolean useLinefeed) {
    try {
        String lineFeed = (useLinefeed ? SystemInfo.getLineSeparator() : null);
        new EdiWriter(lineFeed).writeInterchange(interchange, out);
    } catch (IOException e) {
        throw new TechnicalException("Error writing EDI document", e);
    }
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:11,代码来源:EdifattoContent.java

示例5: enterLine

import org.databene.commons.SystemInfo; //导入方法依赖的package包/类
/** Enters the provided text and appends a line feed.
 * @param text the text to enter
 * @return this */
@SuppressWarnings("unchecked")
public E enterLine(String text) {
    String LF = SystemInfo.getLineSeparator();
    service.perform().enter(processType, processName, processId, text + LF);
    return (E) this;
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:10,代码来源:CommandLineProcess.java

示例6: getDescription

import org.databene.commons.SystemInfo; //导入方法依赖的package包/类
@Override
public String getDescription() {
	return "Sub identity of (" + ArrayFormat.format(parentTableNames) + "):" + 
		SystemInfo.getLineSeparator() + subNkPkQuery;
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:6,代码来源:SubNkPkQueryIdentity.java

示例7: TextFileExporter

import org.databene.commons.SystemInfo; //导入方法依赖的package包/类
public TextFileExporter(String uri, String encoding, String lineSeparator) {
	this.uri = (uri != null ? uri : "export.txt");
    this.encoding = (encoding != null ? encoding : SystemInfo.getFileEncoding());
    this.lineSeparator = (lineSeparator != null ? lineSeparator : SystemInfo.getLineSeparator());
    this.append = false;
}
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:7,代码来源:TextFileExporter.java

示例8: export

import org.databene.commons.SystemInfo; //导入方法依赖的package包/类
@SuppressWarnings("resource")
public static void export(String dbUrl, String dbDriver, String dbSchema,
		String dbUser, String dbPassword, String filename, String encoding, String format, String dialect, 
		ProgressMonitor monitor) {
       if (dbUser == null)
           logger.warn("No JDBC user specified");
       String lineSeparator = SystemInfo.getLineSeparator();
	long startTime = System.currentTimeMillis();

	Consumer exporter = null;
       DefaultDBSystem db = null;
       int count = 0;
       try {
       	// connect DB
           db = new DefaultDBSystem("db", dbUrl, dbDriver, dbUser, dbPassword, new DataModel());
           if (dbSchema != null)
               db.setSchema(dbSchema);
           db.setDynamicQuerySupported(false);

           // create exporter
           if (DBUNIT_FORMAT.equals(format.toLowerCase()))
           	exporter = new DbUnitEntityExporter(filename, encoding);
           else if (XLS_FORMAT.equals(format))
           	exporter = new XLSEntityExporter(filename);
           else if (SQL_FORMAT.equals(format)) {
           	if (dialect == null)
           		dialect = db.getDialect().getSystem();
           	exporter = new SQLEntityExporter(filename, encoding, lineSeparator, dialect);
           } else
           	throw new IllegalArgumentException("Unknown format: " + format);

           // export data
           List<TypeDescriptor> descriptors = Arrays.asList(db.getTypeDescriptors());
           logger.info("Starting export");
           for (TypeDescriptor descriptor : descriptors) {
               String note = "Exporting table " + descriptor.getName();
               if (monitor != null) {
               	monitor.setNote(note);
               	if (monitor.isCanceled())
               		throw new RuntimeException("Export cancelled");
               }
			logger.info(note);
			Thread.yield();
               DataIterator<Entity> source = db.queryEntities(descriptor.getName(), null, null).iterator();
               DataContainer<Entity> container = new DataContainer<Entity>();
               ProductWrapper<Entity> wrapper = new ProductWrapper<Entity>();
			while ((container = source.next(container)) != null) {
				Entity entity = container.getData();
				wrapper.wrap(entity);
                   exporter.startConsuming(wrapper);
				wrapper.wrap(entity);
                   exporter.finishConsuming(wrapper);
                   count++;
               }
               if (monitor != null)
               	monitor.advance();
           }
           long duration = System.currentTimeMillis() - startTime;
           if (count == 0)
           	logger.warn("No entities found for snapshot.");
           else
           	logger.info("Exported " + NumberUtil.format(count, 0) + " entities in " + 
           			RoundedNumberFormat.format(duration, 0) + " ms " +
           			"(" + RoundedNumberFormat.format(count * 3600000L / duration, 0) + " p.h.)");
       } finally {
           IOUtil.close(exporter);
           if (db != null)
               db.close();
       }
}
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:71,代码来源:DBSnapshotTool.java

示例9: getDefaultLineSeparator

import org.databene.commons.SystemInfo; //导入方法依赖的package包/类
@Override
public String getDefaultLineSeparator() {
	return SystemInfo.getLineSeparator();
}
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:5,代码来源:DefaultBeneratorContext.java


注:本文中的org.databene.commons.SystemInfo.getLineSeparator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。