本文整理汇总了Java中java.io.PrintStream.append方法的典型用法代码示例。如果您正苦于以下问题:Java PrintStream.append方法的具体用法?Java PrintStream.append怎么用?Java PrintStream.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.PrintStream
的用法示例。
在下文中一共展示了PrintStream.append方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeClassHeader
import java.io.PrintStream; //导入方法依赖的package包/类
private void writeClassHeader(DexClass clazz, PrintStream ps) {
StringBuilder builder = new StringBuilder();
builder.append(".class ");
builder.append(clazz.accessFlags.toSmaliString());
builder.append(" ");
builder.append(clazz.type.toSmaliString());
builder.append("\n\n");
if (clazz.type != dexItemFactory.objectType) {
builder.append(".super ");
builder.append(clazz.superType.toSmaliString());
builder.append("\n");
for (DexType iface : clazz.interfaces.values) {
builder.append(".implements ");
builder.append(iface.toSmaliString());
builder.append("\n");
}
}
ps.append(builder.toString());
}
示例2: saveTextFile
import java.io.PrintStream; //导入方法依赖的package包/类
public static void saveTextFile(String filepath,GeneralMatrixString text)
{
try
{
FileOutputStream f = new FileOutputStream(filepath);
PrintStream p = new PrintStream(f);
for(int i=0;i<text.height;i++)
{
if(text.value[i]==null)
p.append("\n");
else
p.append(text.value[i]+"\n");
}
p.close();
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
示例3: toJson
import java.io.PrintStream; //导入方法依赖的package包/类
public void toJson(PrintStream ps, Map<String, String> globalTags) {
ps.append("{");
{
ps.append("\n\"metric\":\"").append(getMetric()).append("\",")
.append("\n\"timestamp\":").append(Long.toString(getTimestamp())).append(",")
.append("\n\"value\":").append(String.valueOf(getValue()));
ps.append(",\n\"tags\": {");
Map<String, String> tagsToMarshall = new LinkedHashMap<>(getTags());
if (globalTags != null) {
tagsToMarshall.putAll(globalTags);
}
Iterator<Entry<String, String>> iterator = tagsToMarshall.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, String> tag = iterator.next();
ps.append("\n\"").append(tag.getKey()).append("\":\"")
.append(tag.getValue()).append("\"");
if (iterator.hasNext()) {
ps.append(",");
}
}
ps.append("}\n");
}
ps.append("}");
}
示例4: writeClassFooter
import java.io.PrintStream; //导入方法依赖的package包/类
private void writeClassFooter(DexClass clazz, PrintStream ps) {
StringBuilder builder = new StringBuilder();
builder.append("# End of class ");
builder.append(clazz.type.toSmaliString());
builder.append("\n");
ps.append(builder.toString());
}
示例5: printStackTrace
import java.io.PrintStream; //导入方法依赖的package包/类
@Override
public void printStackTrace(PrintStream err) {
super.printStackTrace(err);
int currentIndex = -1;
for (Throwable throwable : innerThrowables) {
err.append("\n");
err.append(" Inner throwable #");
err.append(Integer.toString(++currentIndex));
err.append(": ");
throwable.printStackTrace(err);
err.append("\n");
}
}
示例6: printStackTrace
import java.io.PrintStream; //导入方法依赖的package包/类
public void printStackTrace(PrintStream err) {
super.printStackTrace(err);
int currentIndex = -1;
for (Throwable throwable : this.innerThrowables) {
err.append("\n");
err.append(" Inner throwable #");
currentIndex++;
err.append(Integer.toString(currentIndex));
err.append(": ");
throwable.printStackTrace(err);
err.append("\n");
}
}
示例7: damageSignature
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Replace the first equals character in META-INF/T_ALIAS.SF "=" found
* after text "Digest-Manifest-Main-Attributes" with character "!".
*/
private void damageSignature(File extractDir)
throws FileNotFoundException, IOException {
File metaInfFile = new File(extractDir, "META-INF");
File tAliasSfFile = new File(metaInfFile, "T_ALIAS.SF");
FileInputStream fis = new FileInputStream(tAliasSfFile);
StringBuilder sb = new StringBuilder();
try {
BufferedInputStream bis = new BufferedInputStream(fis);
try {
InputStreamReader isr = new InputStreamReader(bis, "UTF-8");
try {
char[] buffer = new char[1024];
int read;
while ((read = isr.read(buffer)) != -1) {
sb.append(buffer, 0, read);
}
} finally {
isr.close();
}
} finally {
bis.close();
}
} finally {
fis.close();
}
int mainAttsStart = sb.indexOf("Digest-Manifest-Main-Attributes");
int replacePos = sb.indexOf("=", mainAttsStart);
sb.replace(replacePos, replacePos + 1, "!");
FileOutputStream fos = new FileOutputStream(tAliasSfFile);
try {
BufferedOutputStream bos = new BufferedOutputStream(fos);
try {
PrintStream ps = new PrintStream(bos);
try {
ps.append(sb);
} finally {
ps.close();
}
} finally {
bos.close();
}
} finally {
fos.close();
}
}
示例8: generateRule
import java.io.PrintStream; //导入方法依赖的package包/类
public String generateRule(PrintStream stringBuilder) {
stringBuilder.append("RULE ");
stringBuilder.append(ruleName);
stringBuilder.append(LINEBREAK);
if (isInterface) {
stringBuilder.append("INTERFACE ");
} else {
stringBuilder.append("CLASS ");
}
if (isIncludeSubclases) {
stringBuilder.append("^");
}
stringBuilder.append(className);
stringBuilder.append(LINEBREAK);
stringBuilder.append("METHOD ");
stringBuilder.append(methodName);
stringBuilder.append(LINEBREAK);
stringBuilder.append(where);
stringBuilder.append(LINEBREAK);
if (helperName != null) {
stringBuilder.append("HELPER ");
stringBuilder.append(helperName);
stringBuilder.append(LINEBREAK);
}
if (imports != null) {
stringBuilder.append(imports);
}
if (compile != null) {
stringBuilder.append(compile);
stringBuilder.append(LINEBREAK);
}
if (bind != null) {
stringBuilder.append("BIND ");
stringBuilder.append(bind);
stringBuilder.append(LINEBREAK);
}
stringBuilder.append("IF ");
stringBuilder.append(ifcondition);
stringBuilder.append(LINEBREAK);
stringBuilder.append("DO ");
stringBuilder.append(action);
stringBuilder.append(LINEBREAK);
stringBuilder.append("ENDRULE");
stringBuilder.append(LINEBREAK);
return stringBuilder.toString();
}
示例9: write
import java.io.PrintStream; //导入方法依赖的package包/类
public final void write(PrintStream out) throws IOException {
out.append(sb);
}
示例10: append
import java.io.PrintStream; //导入方法依赖的package包/类
@Override
public PrintStream append(char c) {
for (PrintStream out : streams) {
out.append(c);
}
return this;
}