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


Java Format.setLineSeparator方法代碼示例

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


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

示例1: toString

import org.jdom.output.Format; //導入方法依賴的package包/類
public String toString(Format format) {
    StringWriter xmlout = new StringWriter();
    try {
        format.setLineSeparator(System.getProperty("line.separator"));
        XMLOutputter outputter = new XMLOutputter(format);
        outputter.output(this.element, xmlout);
        // Close the FileWriter
        xmlout.close();
    } catch (java.io.IOException e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
    return xmlout.toString();
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:15,代碼來源:Container.java

示例2: toString

import org.jdom.output.Format; //導入方法依賴的package包/類
/**
 * Return a pretty printed string formatted according to the JDOM Format 
 * @param format the Format object that controls the pretty printing.
 * @return the pretty printed string.
 */
public String toString(Format format) {
    StringWriter xmlout = new StringWriter();
    try {
        format.setLineSeparator(System.getProperty("line.separator"));
        XMLOutputter outputter = new XMLOutputter(format);
        outputter.output(this, xmlout);
        // Close the FileWriter
        xmlout.close();
    } catch (java.io.IOException e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
    return xmlout.toString();
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:20,代碼來源:IOSPDocument.java

示例3: flush

import org.jdom.output.Format; //導入方法依賴的package包/類
public void flush() throws IOException
{
	XMLOutputter xmlcode = new XMLOutputter(Format.getPrettyFormat());
	Format f = xmlcode.getFormat();
	f.setEncoding("ISO-8859-1");
	f.setTextMode(Format.TextMode.PRESERVE);
	f.setLineSeparator(System.getProperty("line.separator"));
	xmlcode.setFormat(f);

	//Open a filewriter
	PrintWriter writer = new PrintWriter(out);
	xmlcode.output(doc, writer);
	out.flush();
}
 
開發者ID:PathVisio,項目名稱:pathvisio,代碼行數:15,代碼來源:DgpmlOutputter.java

示例4: createXML

import org.jdom.output.Format; //導入方法依賴的package包/類
/**
 * Write an XML file containing the interpretation of an expression
 * @param e		: expression which interpretation is to be saved
 * @param file	: path to the file to be created
 */
public static void createXML(Expression e, String file)
{
	// Create the main node (root) of the XML
	Element el = new Element("expression");
	el.setAttribute(new Attribute("width", e.getDimension().width+""));		// Save the width ...
	el.setAttribute(new Attribute("height", e.getDimension().height+""));	// ... and the height.
	el.addContent(createSymbolNode(e.findLeftMost()));						// Add the expression interpretation
	
	// Create the document
	Document doc = new Document(el);
	try {
		// Write the file
	    XMLOutputter outputter = new XMLOutputter();
	    Format f = outputter.getFormat();		// Set the format
	    f.setIndent("     "); 					//	- indent
	    f.setLineSeparator("\r\n"); 			//  - new lines
	    outputter.setFormat(f);
	    outputter.output(doc, new FileWriter(new File(FileManager.get().getWorkspace()+file)));
	} catch (IOException e1) {
	    e1.printStackTrace();
	}
}
 
開發者ID:tbluche,項目名稱:MERStructure,代碼行數:28,代碼來源:XMLCreator.java

示例5: listOfSymbolXML

import org.jdom.output.Format; //導入方法依賴的package包/類
/**
 * Write an XML file containing a list of symbols
 * @param vc	: list of symbols
 * @param file	: path to the file
 */
public static void listOfSymbolXML(Vector<Context> vc, String file)
{
	// XML node with the list of symbols
	Element e = listOfSymbols(vc);
	
	// Creation of the XML document
	Document doc = new Document(e);
	
	// Write the file
	try {
	    XMLOutputter outputter = new XMLOutputter();
	    Format f = outputter.getFormat();
	    f.setIndent("     "); 
	    f.setLineSeparator("\r\n"); 
	    outputter.setFormat(f);
	    outputter.output(doc, new FileWriter(new File(FileManager.get().getWorkspace()+file)));
	} catch (IOException e1) {
	    e1.printStackTrace();
	}
}
 
開發者ID:tbluche,項目名稱:MERStructure,代碼行數:26,代碼來源:XMLCreator.java

示例6: listsOfSymbolXML

import org.jdom.output.Format; //導入方法依賴的package包/類
/**
 * Create an XML file containing the list of symbols for several expressions.
 * @param ve	: list of expressions	
 * @param file	: file to save
 */
public static void listsOfSymbolXML(Vector<Expression> ve, String file) {
	Element root = new Element("expressions");
	
	for (Expression e: ve)
		root.addContent(listOfSymbols(e.getSymbols()));
	
	Document doc = new Document(root);
	try {
	    XMLOutputter outputter = new XMLOutputter();
	    Format f = outputter.getFormat();
	    f.setIndent("  "); // use two space indent
	    f.setLineSeparator("\r\n"); 
	    outputter.setFormat(f);
	    outputter.output(doc, new FileWriter(new File(FileManager.get().getWorkspace()+file)));
	} catch (IOException e1) {
	    e1.printStackTrace();
	}
	
}
 
開發者ID:tbluche,項目名稱:MERStructure,代碼行數:25,代碼來源:XMLCreator.java

示例7: JPFClasspathFixProcessor

import org.jdom.output.Format; //導入方法依賴的package包/類
public JPFClasspathFixProcessor()
{
	super();
	sax = new SAXBuilder();
	sax.setValidation(false);
	sax.setReuseParser(true);
	sax.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
	Format format = Format.getRawFormat();
	format.setOmitEncoding(true);
	format.setOmitDeclaration(true);
	format.setLineSeparator("\n");
	format.setEncoding("UTF-8");

	xmlOut = new XMLOutputter(format);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:16,代碼來源:JPFClasspathFixProcessor.java

示例8: NewPluginWizard

import org.jdom.output.Format; //導入方法依賴的package包/類
public NewPluginWizard()
{
	fFirstPage = new NewJPFPluginWizardPageOne();
	fSecondPage = new NewJavaProjectWizardPageTwo(fFirstPage);
	Format format = Format.getPrettyFormat();
	format.setIndent("\t");
	format.setOmitEncoding(true);
	format.setOmitDeclaration(true);
	format.setLineSeparator("\n");
	format.setEncoding("UTF-8");
	xmlOut = new XMLOutputter(format);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:13,代碼來源:NewPluginWizard.java

示例9: toString

import org.jdom.output.Format; //導入方法依賴的package包/類
public String toString(Format format) {
    StringWriter xmlout = new StringWriter();
    try {
        format.setLineSeparator(System.getProperty("line.separator"));
        XMLOutputter outputter = new XMLOutputter(format);
        outputter.output(this, xmlout);
        // Close the FileWriter
        xmlout.close();
    } catch (java.io.IOException e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
    return xmlout.toString();
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:15,代碼來源:LASDocument.java

示例10: assertXmlOutputEquals

import org.jdom.output.Format; //導入方法依賴的package包/類
private static void assertXmlOutputEquals(String expected, Element root) throws IOException {
  StringWriter writer = new StringWriter();
  Format format = Format.getPrettyFormat();
  format.setLineSeparator("\n");
  new XMLOutputter(format).output(root, writer);
  String actual = writer.toString();
  assertEquals(expected, actual);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:EditorColorsSchemeImplTest.java

示例11: createPrettyFormat

import org.jdom.output.Format; //導入方法依賴的package包/類
private Format createPrettyFormat() {
    final Format prettyFormat = Format.getPrettyFormat();
    prettyFormat.setExpandEmptyElements(expandEmptyElements);
    prettyFormat.setEncoding(encoding);
    prettyFormat.setLineSeparator("\n");
    prettyFormat.setIndent(indentCharacters);
    return prettyFormat;
}
 
開發者ID:Ekryd,項目名稱:sortpom,代碼行數:9,代碼來源:XmlOutputGenerator.java

示例12: getFormat

import org.jdom.output.Format; //導入方法依賴的package包/類
public static Format getFormat(String indent, boolean newlines) {
    Format format = Format.getPrettyFormat();
    format.setIndent(indent);
    if (newlines) {
        format.setLineSeparator("\n"); //$NON-NLS-1$
    } else {
        format.setLineSeparator(""); //$NON-NLS-1$
    }
    return format;
}
 
開發者ID:kenweezy,項目名稱:teiid,代碼行數:11,代碼來源:JdomHelper.java

示例13: writeXML

import org.jdom.output.Format; //導入方法依賴的package包/類
/**
 * Serializes the database to the output stream.
 *
 * @param outputStream the output
 * @param encoding the encoding to use
 * @param indent the indent
 * @param lineSeparator the lineSeparator
 * @throws IOException in case the xml could not be written
 */
public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator)
throws IOException {
  XMLOutputter outputter = new XMLOutputter();
  Format format = Format.getPrettyFormat();
  format.setEncoding(encoding);
  format.setIndent(indent);
  format.setLineSeparator(lineSeparator);
  outputter.setFormat(format);
  outputter.output(getDocument(), outputStream);
}
 
開發者ID:netceteragroup,項目名稱:trema-core,代碼行數:20,代碼來源:XMLDatabase.java

示例14: writeToStream

import org.jdom.output.Format; //導入方法依賴的package包/類
private static void writeToStream(@NotNull OutputStream outputStream, @NotNull Element element) throws IOException {
  OutputStreamWriter writer = new OutputStreamWriter(outputStream);
  Format format = Format.getPrettyFormat();
  format.setLineSeparator("\n");
  new XMLOutputter(format).output(element, writer);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:CodeStyleSchemeCopyExporter.java


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