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


Java PrintStream.printf方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:31,代碼來源:HotSpotJVMCIRuntime.java

示例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");
    }
}
 
開發者ID:JianpingZeng,項目名稱:xcc,代碼行數:18,代碼來源:RegisterInfoEmitter.java

示例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;
}
 
開發者ID:JianpingZeng,項目名稱:xcc,代碼行數:18,代碼來源:Init.java

示例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);
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:27,代碼來源:CodeStatistics.java

示例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(")");
}
 
開發者ID:JianpingZeng,項目名稱:xcc,代碼行數:25,代碼來源:Init.java

示例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);
        }
    }
}
 
開發者ID:vitaly-chibrikov,項目名稱:otus_java_2017_10,代碼行數:18,代碼來源:UnsafeUtil.java

示例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());
    }
}
 
開發者ID:aserg-ufmg,項目名稱:RefDiff,代碼行數:9,代碼來源:RefactoringSet.java

示例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(";");
}
 
開發者ID:JianpingZeng,項目名稱:xcc,代碼行數:13,代碼來源:RecordVal.java

示例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;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:UncommonTrapEvent.java

示例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");
}
 
開發者ID:JianpingZeng,項目名稱:xcc,代碼行數:15,代碼來源:InstrInfoEmitter.java

示例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");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:LogParser.java

示例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);
}
 
開發者ID:arodchen,項目名稱:MaxSim,代碼行數:11,代碼來源:MachCallStaticJavaNode.java

示例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(";");
}
 
開發者ID:aserg-ufmg,項目名稱:RefDiff,代碼行數:8,代碼來源:RefactoringSet.java

示例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));
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:8,代碼來源:Balancer.java

示例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};");
}
 
開發者ID:JianpingZeng,項目名稱:xcc,代碼行數:46,代碼來源:SubtargetEmitter.java


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