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


Java BufferedWriter.append方法代碼示例

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


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

示例1: 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</title>");
	writer.newLine();
	writer.append("    <link rel=\"stylesheet\" href=\"style.css\">");
	writer.newLine();
	writer.append("    <script src=\"jquery-3.2.0.min.js\"></script>");
	writer.newLine();
	writer.append("    <script src=\"stupidtable.min.js\"></script>");
	writer.newLine();
	writer.append("    <script>$(function(){ $(\"table.coverage-summary\").stupidtable(); });</script>");
	writer.newLine();
	writer.append("</head>");
	writer.newLine();
	writer.append("<body>");
	writer.newLine();
}
 
開發者ID:future-architect,項目名稱:uroborosql,代碼行數:25,代碼來源:HtmlReportCoverageHandler.java

示例2: replaceAllProc

import java.io.BufferedWriter; //導入方法依賴的package包/類
private static void replaceAllProc(String a, String b, File product) throws IOException{
	boolean contained = false;
	BufferedReader br = new BufferedReader(new FileReader(product));
	String line;
	StringBuilder sb = new StringBuilder();
	while((line = br.readLine()) != null){
		if(line.contains(a)){
		line = line.replaceAll(a, b);
		contained = true;
		}
		sb.append(line).append("\n");
	}
	br.close();
	BufferedWriter bw = new BufferedWriter(new FileWriter(product));
	bw.append(sb);
	bw.close();
	if(!contained) System.err.println("File "+product+" did not contain String");
}
 
開發者ID:NeoRoy,項目名稱:KeYExperienceReport,代碼行數:19,代碼來源:FeatureIDEReplaceOption.java

示例3: saveNodeViewersFile

import java.io.BufferedWriter; //導入方法依賴的package包/類
public void saveNodeViewersFile(File selectedFile,
        List<String> nodeViewersClassNames) throws IOException {
    if (!selectedFile.exists()) {
        if (!selectedFile.createNewFile()) {
            throw new IOException(
                    "Failed to create node viewers configuration file: "
                            + selectedFile.getAbsolutePath());
        }
    }
    FileWriter writer = new FileWriter(selectedFile);
    try {
        BufferedWriter buff = new BufferedWriter(writer);
        try {
            for (String nodeViewersClassName : nodeViewersClassNames) {
                buff.append(nodeViewersClassName);
                buff.append("\n");
            }
        } finally {
            buff.flush();
            buff.close();
        }
    } finally {
        writer.close();
    }
}
 
開發者ID:l294265421,項目名稱:ZooKeeper,代碼行數:26,代碼來源:ZooInspectorManagerImpl.java

示例4: writeLog

import java.io.BufferedWriter; //導入方法依賴的package包/類
/**
 * 打印信息
 *
 * @param message
 */
public static synchronized void writeLog(String message) {
    File f = getFile();
    if (f != null) {
        try {
            FileWriter fw = new FileWriter(f, true);
            BufferedWriter bw = new BufferedWriter(fw);
            bw.append("\n");
            bw.append(message);
            bw.append("\n");
            bw.flush();
            bw.close();
            fw.close();
        } catch (IOException e) {
            print("writeLog error, " + e.getMessage());
        }
    } else {
        print("writeLog error, due to the file dir is error");
    }
}
 
開發者ID:pre-dem,項目名稱:pre-dem-android,代碼行數:25,代碼來源:LogUtils.java

示例5: configureInputFormat

import java.io.BufferedWriter; //導入方法依賴的package包/類
@Override
public void configureInputFormat(Job job, String tableName,
    String tableClassName, String splitByCol)
    throws ClassNotFoundException, IOException {

  // Write a line of text into a file so that we can get
  // a record to the map task.
  Path dir = new Path(this.options.getTempDir());
  Path p = new Path(dir, "sqoop-dummy-import-job-file.txt");
  FileSystem fs = FileSystem.getLocal(this.options.getConf());
  if (fs.exists(p)) {
    boolean result = fs.delete(p, false);
    assertTrue("Couldn't delete temp file!", result);
  }

  BufferedWriter w = new BufferedWriter(
      new OutputStreamWriter(fs.create(p)));
  w.append("This is a line!");
  w.close();

  FileInputFormat.addInputPath(job, p);

  // And set the InputFormat itself.
  super.configureInputFormat(job, tableName, tableClassName, splitByCol);
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:26,代碼來源:TestImportJob.java

示例6: writeLog

import java.io.BufferedWriter; //導入方法依賴的package包/類
/**
 * 打印信息
 * @param message
 */
public static synchronized void writeLog(String message) {
    File f = getFile();
    if (f != null) {
        try {
            FileWriter fw = new FileWriter(f , true);
            BufferedWriter bw = new BufferedWriter(fw);
            bw.append("\n");
            bw.append(message);
            bw.append("\n");
            bw.flush();
            bw.close();
            fw.close();
        } catch (IOException e) {
            print("writeLog error, " + e.getMessage());
        }
    } else {
        print("writeLog error, due to the file dir is error");
    }
}
 
開發者ID:Evan-Galvin,項目名稱:FreeStreams-TVLauncher,代碼行數:24,代碼來源:LogUtil.java

示例7: writeTablePrefix

import java.io.BufferedWriter; //導入方法依賴的package包/類
private void writeTablePrefix(BufferedWriter writer) throws IOException {
	writer.append("<div class=\"inner\">");
	writer.newLine();
	writer.append("<table class=\"coverage-summary\">");
	writer.newLine();
	writer.append("<thead>");
	writer.newLine();
	writer.append("<tr>");
	writer.newLine();
	writer.append("   <th data-sort=\"string\" class=\"file sorting-asc\" >File</th>");
	writer.newLine();
	writer.append("   <th class=\"pic\" ></th>");
	writer.newLine();
	writer.append("   <th data-sort=\"int\" class=\"lines\" >Lines</th>");
	writer.newLine();
	writer.append("   <th class=\"lines-raw\"></th>");
	writer.newLine();
	writer.append("   <th data-sort=\"int\" class=\"branches\" >Branches</th>");
	writer.newLine();
	writer.append("   <th class=\"branches-raw\"></th>");
	writer.newLine();
	writer.append("</tr>");
	writer.newLine();
	writer.append("</thead>");
	writer.newLine();
	writer.append("<tbody>");
	writer.newLine();

}
 
開發者ID:future-architect,項目名稱:uroborosql,代碼行數:30,代碼來源:HtmlReportCoverageHandler.java

示例8: createTempFile

import java.io.BufferedWriter; //導入方法依賴的package包/類
public static String createTempFile(String contents) throws IOException {
    File file = File.createTempFile("gnuplot_", ".dat");
    BufferedWriter out = new BufferedWriter(new FileWriter(file));
    out.append(contents);
    out.close();
    return file.getAbsolutePath();
}
 
開發者ID:teras,項目名稱:JavaPlot,代碼行數:8,代碼來源:FileUtils.java

示例9: printGroupInfo

import java.io.BufferedWriter; //導入方法依賴的package包/類
/** 
    * Display info about a thread group 
    * @throws IOException 
    */
private void printGroupInfo(ThreadGroup g, String indent, BufferedWriter w) throws IOException 
{
	if (g == null)
	{
	   return;
	}
	int numThreads = g.activeCount();
	int numGroups = g.activeGroupCount();
	Thread[] threads = new Thread[numThreads];
	ThreadGroup[] groups = new ThreadGroup[numGroups];

	g.enumerate(threads, false);
	g.enumerate(groups, false);

	w.append(indent + "Thread Group: " + g.getName()
	   + "  Max Priority: " + g.getMaxPriority()
	   + (g.isDaemon() ? " Daemon" : ""));
	w.newLine();

	for (int i = 0; i < numThreads; i++)
	{
	      printThreadInfo(threads[i], indent + "    ", w);
	}
	for (int i = 0; i < numGroups; i++)
	{
	      printGroupInfo(groups[i], indent + "    ", w);
	}
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:33,代碼來源:ShutdownBackstop.java

示例10: begin

import java.io.BufferedWriter; //導入方法依賴的package包/類
void begin() throws IOException {
  try {
    _conn = (HttpsURLConnection) _url.openConnection();
    _conn.setRequestMethod("POST");
    for (Map.Entry<String, String> entry : _config.header.entrySet()) {
      _conn.setRequestProperty(entry.getKey(), entry.getValue());
    }
    _conn.setUseCaches(false);
    _conn.setDoInput(false);
    _conn.setDoOutput(true);
    _conn.connect();

    _writer = new BufferedWriter(new OutputStreamWriter(_conn.getOutputStream()));
    _writer.append("{\"app\":\"").append(_config.app)
        .append("\",\"version\":\"").append(_config.version)
        .append("\",\"relay_app_id\":\"").append(_config.relayAppId);

    if (_envInfo.device != null) {
      _writer.append("\",\"device\":\"").append(_envInfo.device);
    }

    if (_envInfo.getAppUsedMemory() > 0) {
      _writer.append("\",\"app_mem_used\":\"").append(Long.toString(_envInfo.getAppUsedMemory()));
    }

    if (_envInfo.getDeviceFreeMemory() > 0) {
      _writer.append("\",\"device_mem_free\":\"").append(Long.toString(_envInfo.getDeviceFreeMemory()));
    }

    if (_envInfo.getDeviceTotalMemory() > 0) {
      _writer.append("\",\"device_mem_total\":\"").append(Long.toString(_envInfo.getDeviceTotalMemory()));
    }

    if (_envInfo.getBatteryLevel() > 0) {
      _writer.append("\",\"battery_level\":\"").append(Float.toString(_envInfo.getBatteryLevel()));
    }

    if (_envInfo.getCountry() != null) {
      _writer.append("\",\"country\":\"").append(_envInfo.getCountry());
    }

    if (_envInfo.getRegion() != null) {
      _writer.append("\",\"region\":\"").append(_envInfo.getRegion());
    }

    if (_envInfo.network != null) {
      _writer.append("\",\"network\":\"").append(_envInfo.network);
    }

    if (_envInfo.osName != null) {
      _writer.append("\",\"os\":\"").append(_envInfo.osName);
    }

    if (_envInfo.osVersion != null) {
      _writer.append("\",\"os_version\":\"").append(_envInfo.osVersion);
    }

    _writer.append("\",\"measurements\":[");
    _measurements = 0;

  } catch (Exception e) {
    if (_config.debug) {
      Log.d(TAG, e.getMessage());
    }
    disconnect();
    if (e instanceof IOException) {
      throw e;
    }
  }
}
 
開發者ID:rakutentech,項目名稱:android-perftracking,代碼行數:71,代碼來源:EventWriter.java

示例11: escreverToken

import java.io.BufferedWriter; //導入方法依賴的package包/類
public void escreverToken(String path) throws IOException {
	BufferedWriter bf = new BufferedWriter(new FileWriter(path));
	for (int x = 0; x < lexemas.size(); x++) {
		bf.append(lexemas.get(x) + " / " + tipos.get(x));
		bf.newLine();
	}
	bf.close();
}
 
開發者ID:mundodehads,項目名稱:cc-unespar,代碼行數:9,代碼來源:Token.java

示例12: appendNotCovered

import java.io.BufferedWriter; //導入方法依賴的package包/類
private void appendNotCovered(BufferedWriter writer, int start, int end) throws IOException {
	String html = buildLinesHtml(this.sql.substring(start, end),
			"<span class=\"not-covered\" title=\"statement not covered\" >", "</span>");
	writer.append(html);
}
 
開發者ID:future-architect,項目名稱:uroborosql,代碼行數:6,代碼來源:SqlCoverageReport.java

示例13: writeSuffix

import java.io.BufferedWriter; //導入方法依賴的package包/類
private void writeSuffix(BufferedWriter writer) throws IOException {
	writer.append("</body>");
}
 
開發者ID:future-architect,項目名稱:uroborosql,代碼行數:4,代碼來源:HtmlReportCoverageHandler.java

示例14: writeTableSuffix

import java.io.BufferedWriter; //導入方法依賴的package包/類
private void writeTableSuffix(BufferedWriter writer) throws IOException {
	writer.append("</tr>");
	writer.newLine();
	writer.append("</table>");
	writer.newLine();
}
 
開發者ID:future-architect,項目名稱:uroborosql,代碼行數:7,代碼來源:SqlCoverageReport.java

示例15: reloadUsingSourceControl

import java.io.BufferedWriter; //導入方法依賴的package包/類
/**
 * Currently svn Update
 *
 *
 * @param scmUserid
 * @param scmPass
 * @param scmBranch
 * @param requireXml
 * @param svcName
 * @param request
 * @param response
 * @return
 * @throws IOException
 */
private boolean reloadUsingSourceControl (
											String scmUserid, String encryptedPass,
											String scmBranch, String svcName,
											BufferedWriter outputWriter )
		throws IOException {

	try {
		ServiceInstance serviceInstance = new ServiceInstance();
		serviceInstance.setScmLocation( csapApp.getSourceLocation() );
		serviceInstance.setScm( csapApp.getSourceType() );

		File definitionFolder = new File( csapApp.getRootModelBuildLocation() );

		//back_up_to_csap_saved( clusterFileName, outputWriter );
		StringBuilder output = new StringBuilder();
		csapApp.move_to_csap_saved_folder( definitionFolder, output );
		outputWriter.append( output.toString() );

		sourceControlManager.checkOutFolder(
			scmUserid, encryptedPass, scmBranch,
			definitionFolder.getName(), 
			serviceInstance, outputWriter );

	} catch (TransportException gitException) {
		logger.error( "Definition reload failed: {}", CSAP.getCsapFilteredStackTrace( gitException ) );

		outputWriter.write( "\n\n" + CSAP.CONFIG_PARSE_ERROR
				+ "Git Access Error: Verify credentials and path is correct:\n" + gitException.getMessage() );

		return false;
	} catch (Exception e) {
		logger.error( "Definition reload failed: {}", CSAP.getCsapFilteredStackTrace( e ) );

		outputWriter.write( "\n\n" + CSAP.CONFIG_PARSE_ERROR
				+ "SVN Failure: Verify password and target is correct:\n" + e );

		if ( e.toString().indexOf( "is already a working copy for a different URL" ) != -1 ) {
			File svnCheckoutFolder = new File( Application.BUILD_DIR + svcName );
			outputWriter.write( "Blowing away previous build folder, try again:"
					+ svnCheckoutFolder );
			FileUtils.deleteQuietly( svnCheckoutFolder );
		}
		return false;
	}
	return true;
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:61,代碼來源:DefinitionRequests.java


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