本文整理汇总了Java中java.io.PrintStream.printf方法的典型用法代码示例。如果您正苦于以下问题:Java PrintStream.printf方法的具体用法?Java PrintStream.printf怎么用?Java PrintStream.printf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.PrintStream
的用法示例。
在下文中一共展示了PrintStream.printf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printProperties
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Prints a description of the properties used to configure shared JVMCI code.
*
* @param out stream to print to
*/
public static void printProperties(PrintStream out) {
out.println("[JVMCI properties]");
Option[] values = values();
for (Option option : values) {
Object value = option.getValue();
if (value instanceof String) {
value = '"' + String.valueOf(value) + '"';
}
String name = option.getPropertyName();
String assign = option.isDefault ? "=" : ":=";
String typeName = option.type.getSimpleName();
String linePrefix = String.format("%s %s %s ", name, assign, value);
int typeStartPos = PROPERTY_LINE_WIDTH - typeName.length();
int linePad = typeStartPos - linePrefix.length();
if (linePad > 0) {
out.printf("%s%-" + linePad + "s[%s]%n", linePrefix, "", typeName);
} else {
out.printf("%s[%s]%n", linePrefix, typeName);
}
for (String line : option.helpLines) {
out.printf("%" + PROPERTY_HELP_INDENT + "s%s%n", "", line);
}
}
}
示例2: generateValueTypeForRegClass
import java.io.PrintStream; //导入方法依赖的package包/类
private void generateValueTypeForRegClass(PrintStream os)
{
ArrayList<CodeGenRegisterClass> regClasses = target.getRegisterClasses();
for (CodeGenRegisterClass rc : regClasses)
{
// Given the value type a legal Java name if it is anonymous.
String name = rc.theDef.getName() + "VTs";
os.printf("\n\t// %s Register Class Value Type...\n", name);
os.printf("\tpublic static final EVT[] %s = {\n\t\t", name);
for (int i = 0; i < rc.vts.size(); i++)
os.printf("new EVT(new MVT(%s)), ", MVT.getEnumName((rc.vts.get(i))));
os.print("new EVT(new MVT(MVT.Other))\n\t};\n\n");
}
}
示例3: printInHex
import java.io.PrintStream; //导入方法依赖的package包/类
public boolean printInHex(PrintStream os)
{
int result = 0;
for (int i = 0, e = getNumBits(); i < e; i++)
{
Init bit = getBit(i);
if (bit instanceof BitInit)
{
result |= (((BitInit)bit).getValue() ? 1:0) << i;
}
else
return true;
}
os.printf("0x%s", Long.toHexString(result).toUpperCase());
return false;
}
示例4: dumpStatistics
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Prints out the collected statistics.
*
* @param out {@code non-null;} where to output to
*/
public static void dumpStatistics(PrintStream out) {
out.printf("Optimizer Delta Rop Insns: %d total: %d "
+ "(%.2f%%) Delta Registers: %d\n",
runningDeltaInsns,
runningTotalInsns,
(100.0 * (((float) runningDeltaInsns)
/ (runningTotalInsns + Math.abs(runningDeltaInsns)))),
runningDeltaRegisters);
out.printf("Optimizer Delta Dex Insns: Insns: %d total: %d "
+ "(%.2f%%) Delta Registers: %d\n",
dexRunningDeltaInsns,
dexRunningTotalInsns,
(100.0 * (((float) dexRunningDeltaInsns)
/ (dexRunningTotalInsns
+ Math.abs(dexRunningDeltaInsns)))),
dexRunningDeltaRegisters);
out.printf("Original bytecode byte count: %d\n",
runningOriginalBytes);
}
示例5: print
import java.io.PrintStream; //导入方法依赖的package包/类
@Override
public void print(PrintStream os)
{
os.print("(");
val.print(os);
if (!varName.isEmpty())
os.printf(":%s", varName);
if (!args.isEmpty())
{
os.print(" ");
args.get(0).print(os);
if (!argNames.get(0).isEmpty())
os.printf(":$%s", argNames.get(0));
for (int i = 1, e = args.size(); i < e; i++)
{
os.print(", ");
args.get(i).print(os);
if (!argNames.get(i).isEmpty())
os.printf(":$%s", argNames.get(i));
}
}
os.print(")");
}
示例6: dumpObject
import java.io.PrintStream; //导入方法依赖的package包/类
public static void dumpObject(PrintStream ps, Object object) throws Exception {
ps.println("dumpObject: " + object.getClass());
final long address = addressOf(object);
dumpHeader(ps, object);
Class clazz = object.getClass();
for (Field field : clazz.getDeclaredFields()) {
long offset = unsafe.objectFieldOffset(field);
long size = sizeOfType(field.getType());
ps.printf("[%02x+%d]: %d\t%s\n", address, offset, size, field);
if (field.getType() == String.class) {
System.out.println(String .format("Ref: %02x", unsafe.getLong(address + offset)));
dumpString((String) field.get(object));
} else {
dump(ps, address + offset, size);
}
}
}
示例7: printCsv
import java.io.PrintStream; //导入方法依赖的package包/类
public void printCsv(PrintStream pw) {
ArrayList<RefactoringRelationship> list = new ArrayList<>();
list.addAll(refactorings);
Collections.sort(list);
for (RefactoringRelationship r : list) {
pw.printf("%s\t%s\t%s\n", r.getRefactoringType().getDisplayName(), r.getEntityBefore(), r.getEntityAfter());
}
}
示例8: print
import java.io.PrintStream; //导入方法依赖的package包/类
public void print(PrintStream os, boolean printSem)
{
if (getPrefix() != 0) os.print("field ");
getType().print(os);
os.printf(" %s", getName());
if (getValue() != null)
{
os.print(" = ");
getValue().print(os);
}
if (printSem) os.println(";");
}
示例9: print
import java.io.PrintStream; //导入方法依赖的package包/类
public void print(PrintStream stream, boolean printID) {
if (printID) {
stream.print(getId() + " ");
}
stream.printf("uncommon trap %s %s %s\n", bytecode, getReason(), getAction());
int indent = 2;
for (int j = 0; j < jvmsMethods.size(); j++) {
for (int i = 0; i < indent; i++) {
stream.print(' ');
}
stream.println("@ " + jvmsBCIs.get(j) + " " + jvmsMethods.get(j));
indent += 2;
}
}
示例10: printBarriers
import java.io.PrintStream; //导入方法依赖的package包/类
private static void printBarriers(ArrayList<Record> barriers, int num, PrintStream os)
{
os.printf("\tpublic static final TargetRegisterClass[] barriers%d = { ", num);
int e = barriers.size();
if (e > 0)
{
os.printf("%sRegisterClass", barriers.get(0).getName());
for(int i = 1; i != e; ++i)
{
os.printf(", %sRegisterClass", barriers.get(i).getName());
}
}
os.printf("};\n");
}
示例11: print
import java.io.PrintStream; //导入方法依赖的package包/类
@Override
public void print(PrintStream stream, boolean printID) {
if (printID) {
stream.printf("%s ", getId());
}
stream.printf("%s %s %s %.3f ", tagName, kind, classId, getStart());
stream.print(jvms.toString());
stream.print("\n");
}
示例12: dumpSpec
import java.io.PrintStream; //导入方法依赖的package包/类
public void dumpSpec(PrintStream st) {
st.print("Static ");
String n = name();
if (n != null) {
st.printf("wrapper for: %s", n);
// dump_trap_args(st);
st.print(" ");
}
super.dumpSpec(st);
}
示例13: printSourceCode
import java.io.PrintStream; //导入方法依赖的package包/类
public void printSourceCode(PrintStream pw) {
pw.printf("new RefactoringSet(\"%s\", \"%s\")", project, revision);
for (RefactoringRelationship r : refactorings) {
pw.printf("\n .add(RefactoringType.%s, \"%s\", \"%s\")", r.getRefactoringType().toString(), r.getEntityBefore(), r.getEntityAfter());
}
pw.println(";");
}
示例14: print
import java.io.PrintStream; //导入方法依赖的package包/类
void print(int iteration, PrintStream out) {
out.printf("%-24s %10d %19s %18s %17s%n",
DateFormat.getDateTimeInstance().format(new Date()), iteration,
StringUtils.byteDesc(bytesAlreadyMoved),
StringUtils.byteDesc(bytesLeftToMove),
StringUtils.byteDesc(bytesBeingMoved));
}
示例15: cpuKeyValues
import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Emit data of all the subtarget processors. Used by command line.
* @param os
*/
private void cpuKeyValues(PrintStream os) throws Exception
{
ArrayList<Record> processorList = records.getAllDerivedDefinition("Processor");
processorList.sort(LessRecord);
os.printf( "\t// Sorted (by key) array of values for CPU subtype.\n" +
"\tpublic static final SubtargetFeatureKV[] subTypeKV = {\n");
// For each processor.
for (int i = 0, e = processorList.size(); i != e; i++)
{
Record processor = processorList.get(i);
String name = processor.getValueAsString("Name");
ArrayList<Record> featureList = processor.getValueAsListOfDefs("Features");
// Emit as { "cpu", "description", f1 | f2 | ... fn },
os.printf("\t\tnew SubtargetFeatureKV(\"%s\", \"Select the %s processor\", ",
name, name);
if (featureList.isEmpty())
os.print("0");
else
{
for (int j = 0, sz = featureList.size(); j != sz; j++)
{
os.printf(featureList.get(j).getName());
if (j < sz - 1) os.printf(" | ");
}
}
// The "0" is for the "implies" section of this data structure.
os.printf(", 0)");
if (i < e - 1) os.printf(",");
os.println();
}
// End processor table
os.println("\t};");
}