本文整理汇总了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();
}
示例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");
}
示例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();
}
}
示例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");
}
}
示例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);
}
示例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");
}
}
示例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();
}
示例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();
}
示例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);
}
}
示例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;
}
}
}
示例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();
}
示例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);
}
示例13: writeSuffix
import java.io.BufferedWriter; //导入方法依赖的package包/类
private void writeSuffix(BufferedWriter writer) throws IOException {
writer.append("</body>");
}
示例14: writeTableSuffix
import java.io.BufferedWriter; //导入方法依赖的package包/类
private void writeTableSuffix(BufferedWriter writer) throws IOException {
writer.append("</tr>");
writer.newLine();
writer.append("</table>");
writer.newLine();
}
示例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;
}