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


Java BufferedWriter.newLine方法代碼示例

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


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

示例1: battleLogger

import java.io.BufferedWriter; //導入方法依賴的package包/類
public static void battleLogger(String str) {

		String path = File.separator + "BattleLog.txt";
		File file = new File(path);
		try {
			FileWriter fw = new FileWriter(file.getName(), true);
			BufferedWriter bw = new BufferedWriter(fw);

			Date now = new Date();
			bw.write(DateFormat.getDateInstance(DateFormat.SHORT).format(now) + " " + DateFormat.getTimeInstance().format(now) + " - " + str);
			bw.newLine();

			bw.flush();
			bw.close();
		} catch (Exception e) {
			System.out.println("Battle log failure");
		}
	}
 
開發者ID:Maximuspayne,項目名稱:NavyCraft2-Lite,代碼行數:19,代碼來源:CraftMover.java

示例2: writeFile

import java.io.BufferedWriter; //導入方法依賴的package包/類
/**
* write cofiguration
* @return
* @throws IOException
*/
 private File writeFile() throws IOException {

   File f = new File(testDir, "tst.xml");
   BufferedWriter out = new BufferedWriter(new FileWriter(f));
   String properties = "<properties><property key=\"key\" value=\"value\"/><property key=\"key1\" value=\"value1\"/></properties>";
   out.write("<queues>");
   out.newLine();
   out.write("<queue><name>first</name><acl-submit-job>user1,user2 group1,group2</acl-submit-job><acl-administer-jobs>user3,user4 group3,group4</acl-administer-jobs><state>running</state></queue>");
   out.newLine();
   out.write("<queue><name>second</name><acl-submit-job>u1,u2 g1,g2</acl-submit-job>"
       + properties + "<state>stopped</state></queue>");
   out.newLine();
   out.write("</queues>");
   out.flush();
   out.close();
   return f;

 }
 
開發者ID:naver,項目名稱:hadoop,代碼行數:24,代碼來源:TestQueue.java

示例3: log2File

import java.io.BufferedWriter; //導入方法依賴的package包/類
/**
 * 打開日誌文件並寫入日誌
 *
 * @return
 **/
private synchronized static void log2File(String mylogtype, String tag, String text) {
    Date nowtime = new Date();
    String date = FILE_SUFFIX.format(nowtime);
    String dateLogContent = LOG_FORMAT.format(nowtime) + ":" + mylogtype + ":" + tag + ":" + text; // 日誌輸出格式
    File destDir = new File(LOG_FILE_PATH);
    if (!destDir.exists()) {
        destDir.mkdirs();
    }
    File file = new File(LOG_FILE_PATH, LOG_FILE_NAME + date);
    try {
        FileWriter filerWriter = new FileWriter(file, true);
        BufferedWriter bufWriter = new BufferedWriter(filerWriter);
        bufWriter.write(dateLogContent);
        bufWriter.newLine();
        bufWriter.close();
        filerWriter.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:zwmlibs,項目名稱:BookReader-master,代碼行數:26,代碼來源:LogUtils.java

示例4: save

import java.io.BufferedWriter; //導入方法依賴的package包/類
public void save(OutputStream outStream, boolean sorted) throws IOException {
	if (!sorted) {
		save(outStream);
		return;
	}
    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream, "UTF-8"));
    String aKey;
    Object aValue;
    TreeMap tm = new TreeMap(this);
    for (Iterator i = tm.keySet().iterator(); i.hasNext();) {
        aKey = (String) i.next();
        aValue = get(aKey);
        out.write(aKey + " = " + aValue);
        out.newLine();
    }
    out.flush();
    out.close();
}
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:19,代碼來源:LoadableProperties.java

示例5: testExtract

import java.io.BufferedWriter; //導入方法依賴的package包/類
public void testExtract() throws Exception
{
    List<File> fileList = FolderWalker.open(FOLDER);
    Map<String, String> phraseMap = new TreeMap<String, String>();
    int i = 0;
    for (File file : fileList)
    {
        System.out.print(++i + " / " + fileList.size() + " " + file.getName() + " ");
        String path = file.getAbsolutePath();
        List<String> phraseList = MutualInformationEntropyPhraseExtractor.extract(IOUtil.readTxt(path), 3);
        System.out.print(phraseList);
        for (String phrase : phraseList)
        {
            phraseMap.put(phrase, file.getAbsolutePath());
        }
        System.out.println();
    }
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("data/phrase.txt")));
    for (Map.Entry<String, String> entry : phraseMap.entrySet())
    {
        bw.write(entry.getKey() + "\t" + entry.getValue());
        bw.newLine();
    }
    bw.close();
}
 
開發者ID:priester,項目名稱:hanlpStudy,代碼行數:26,代碼來源:TestPhrase.java

示例6: store0

import java.io.BufferedWriter; //導入方法依賴的package包/類
private void store0(BufferedWriter bw, String comments, boolean escUnicode)
    throws IOException
{
    if (comments != null) {
        writeComments(bw, comments);
    }
    bw.write("#" + new Date().toString());
    bw.newLine();
    synchronized (this) {
        for (Map.Entry<Object, Object> e : entrySet()) {
            String key = (String)e.getKey();
            String val = (String)e.getValue();
            key = saveConvert(key, true, escUnicode);
            /* No need to escape embedded and trailing spaces for value, hence
             * pass false to flag.
             */
            val = saveConvert(val, false, escUnicode);
            bw.write(key + "=" + val);
            bw.newLine();
        }
    }
    bw.flush();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:Properties.java

示例7: save

import java.io.BufferedWriter; //導入方法依賴的package包/類
public void save(OutputStream outStream) throws IOException {
    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream, "UTF-8"));
    String aKey;
    Object aValue;
    for (Enumeration e = keys(); e.hasMoreElements();) {
        aKey = (String) e.nextElement();
        aValue = get(aKey);
        out.write(aKey + " = " + aValue);
        out.newLine();
    }
    out.flush();
    out.close();
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:14,代碼來源:LoadableProperties.java

示例8: writeQValues

import java.io.BufferedWriter; //導入方法依賴的package包/類
public static void writeQValues(File outputFile, String description, List<Double> qValuesReal, List<Double> qValuesPred)throws Exception{
	if(!outputFile.getParentFile().exists())outputFile.getParentFile().mkdirs();
	BufferedWriter bw=new BufferedWriter(new FileWriter(outputFile));
	bw.write(description);
	bw.newLine();
	bw.write("calculated qValue\testimated qValue");
	bw.newLine();
	double sum=0;
	int n=0;
	for(int i=0;i<qValuesReal.size();i++){
		sum+=qValuesPred.get(i);
		n+=1;
		if(i==qValuesReal.size()-1||Double.compare(qValuesReal.get(i+1),qValuesReal.get(i))!=0){
			bw.write(qValuesReal.get(i)+"\t"+sum/n);
			bw.newLine();
			n=0;
			sum=0;
		}
	}


	bw.close();
}
 
開發者ID:boecker-lab,項目名稱:passatuto,代碼行數:24,代碼來源:EMUtils.java

示例9: writePrefix

import java.io.BufferedWriter; //導入方法依賴的package包/類
private void writePrefix(BufferedWriter writer) throws IOException {
	writer.append("<!DOCTYPE html>");
	writer.newLine();
	writer.append("<html lang=\"en\">");
	writer.newLine();
	writer.append("<head>");
	writer.newLine();
	writer.append("    <meta charset=\"utf-8\" />");
	writer.newLine();
	writer.append("    <title>uroboroSQL code coverage report for ").append(this.name).append("</title>");
	writer.newLine();
	writer.append("    <link rel=\"stylesheet\" href=\"").append(getAssetPath()).append("/style.css\">");
	writer.newLine();
	writer.append("    <script src=\"").append(getAssetPath()).append("/jquery-3.2.0.min.js\"></script>");
	writer.newLine();
	writer.append("    <script src=\"").append(getAssetPath()).append("/highlight.pack.js\"></script>");
	writer.newLine();
	writer.append("    <script src=\"").append(getAssetPath()).append("/sqlcov.js\"></script>");
	writer.newLine();
	writer.append("</head>");
	writer.newLine();
	writer.append("<body>");
	writer.newLine();
}
 
開發者ID:future-architect,項目名稱:uroborosql,代碼行數:25,代碼來源:SqlCoverageReport.java

示例10: writeComments

import java.io.BufferedWriter; //導入方法依賴的package包/類
private static void writeComments(BufferedWriter bw, String comments)
    throws IOException {
    bw.write("#");
    int len = comments.length();
    int current = 0;
    int last = 0;
    char[] uu = new char[6];
    uu[0] = '\\';
    uu[1] = 'u';
    while (current < len) {
        char c = comments.charAt(current);
        if (c > '\u00ff' || c == '\n' || c == '\r') {
            if (last != current)
                bw.write(comments.substring(last, current));
            if (c > '\u00ff') {
                uu[2] = toHex((c >> 12) & 0xf);
                uu[3] = toHex((c >>  8) & 0xf);
                uu[4] = toHex((c >>  4) & 0xf);
                uu[5] = toHex( c        & 0xf);
                bw.write(new String(uu));
            } else {
                bw.newLine();
                if (c == '\r' &&
                    current != len - 1 &&
                    comments.charAt(current + 1) == '\n') {
                    current++;
                }
                if (current == len - 1 ||
                    (comments.charAt(current + 1) != '#' &&
                    comments.charAt(current + 1) != '!'))
                    bw.write("#");
            }
            last = current + 1;
        }
        current++;
    }
    if (last != current)
        bw.write(comments.substring(last, current));
    bw.newLine();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:41,代碼來源:Properties.java

示例11: createDefaultDbProperties

import java.io.BufferedWriter; //導入方法依賴的package包/類
private static void createDefaultDbProperties(String path) throws IOException{
	File file = new File(path);
	if(!file.getParentFile().exists()){
		file.getParentFile().mkdirs();
	}
	file.createNewFile();
	
	FileWriter fw = new FileWriter(file);
	BufferedWriter write = new BufferedWriter(fw);
	write.write("mail.transport.protocol=");
	write.newLine();
	write.write("mail.smtp.port=");
	write.newLine();
	write.write("mail.smtp.host=");
	write.newLine();
	write.write("mail.smtp.username=");
	write.newLine();
	write.write("mail.smtp.password=");
	write.newLine();
	write.write("mail.smtp.connectiontimeout=");
	write.newLine();
	write.write("mail.smtp.timeout=");
	write.newLine();
	write.write("mail.smtp.auth=");
	write.flush();
	
	write.close();
	fw.close();
}
 
開發者ID:wrayzheng,項目名稱:webpage-update-subscribe,代碼行數:30,代碼來源:SysConfig.java

示例12: printThreadInfo

import java.io.BufferedWriter; //導入方法依賴的package包/類
private void printThreadInfo(Thread t, String indent, BufferedWriter w) throws IOException 
{
	if (t == null){
		return;
	}

	w.write(indent + "Thread: " + t.getName() + "  Priority: "
	        + t.getPriority() + (t.isDaemon() ? " Daemon" : "")
	        + (t.isAlive() ? "" : " Not Alive"));
	w.newLine();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:12,代碼來源:ShutdownBackstop.java

示例13: generateFile

import java.io.BufferedWriter; //導入方法依賴的package包/類
public static void generateFile(World world, int x, int y, int z, String path) {
	try {
		BufferedWriter bw = new BufferedWriter(new FileWriter(new File(path)));

		for (int i = 0; i < 58; i++)
			for (int j = 0; j < 31 - 9; j++)
				for (int k = 0; k < 58; k++) {
					Block b = world.getBlock(x + i, y + j, z + k);
					int meta = world.getBlockMetadata(x + i, y + j, z + k);

					String s = "(" + i + ", " + j + ", " + k + ") - ";
					if (b == ModBlocks.prismarine)
						s += meta;
					else if (b == ModBlocks.sea_lantern)
						s += 3;
					else if (b == Blocks.gold_block)
						s += 4;
					else if (b == Blocks.sponge)
						s += 5;
					else if (b == Blocks.stained_glass)
						s += 6;
					else
						s = null;

					if (s != null) {
						bw.write(s);
						bw.newLine();
					}
				}

		bw.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:36,代碼來源:OceanMonument.java

示例14: storeClassesAndMethods

import java.io.BufferedWriter; //導入方法依賴的package包/類
public static void storeClassesAndMethods(List<ClassAndMethods> cams, File file)
    throws IOException {
  FileWriter fw = new FileWriter(file);
  BufferedWriter out = new BufferedWriter(fw);
  for (ClassAndMethods entry : cams) {
    out.append(ClassAndMethodDetails.convertForStoring(entry));
    out.newLine();
  }
  out.flush();
  out.close();
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:12,代碼來源:CompiledClassUtils.java

示例15: body

import java.io.BufferedWriter; //導入方法依賴的package包/類
public static void body(BufferedWriter wrlatex, List<Section> listSections, String referenceLink) throws IOException {
	for (int j = 0; j < listSections.size(); j++) {
		Section section = listSections.get(j);
		sectionWriting(wrlatex, section);
	} //end of Sections
	wrlatex.newLine();
	wrlatex.write("\\bibliography{");
	wrlatex.write(referenceLink);
	wrlatex.write("}");
	wrlatex.newLine();
	wrlatex.write("\\end{document}");
	wrlatex.close();

}
 
開發者ID:Vitaliy-1,項目名稱:JATS2LaTeX,代碼行數:15,代碼來源:BodyStandard.java


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