当前位置: 首页>>代码示例>>Java>>正文


Java IndentingWriter.p方法代码示例

本文整理汇总了Java中sun.rmi.rmic.newrmic.IndentingWriter.p方法的典型用法代码示例。如果您正苦于以下问题:Java IndentingWriter.p方法的具体用法?Java IndentingWriter.p怎么用?Java IndentingWriter.p使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.rmi.rmic.newrmic.IndentingWriter的用法示例。


在下文中一共展示了IndentingWriter.p方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeMethodFieldInitializers

import sun.rmi.rmic.newrmic.IndentingWriter; //导入方法依赖的package包/类
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:StubSkeletonWriter.java

示例2: writeOperationsArray

import sun.rmi.rmic.newrmic.IndentingWriter; //导入方法依赖的package包/类
/**
 * Writes declaration and initializer for "operations" static array.
 **/
private void writeOperationsArray(IndentingWriter p)
    throws IOException
{
    p.plnI("private static final " + OPERATION + "[] operations = {");
    for (int i = 0; i < remoteMethods.length; i++) {
        if (i > 0)
            p.pln(",");
        p.p("new " + OPERATION + "(\"" +
            remoteMethods[i].operationString() + "\")");
    }
    p.pln();
    p.pOln("};");
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:StubSkeletonWriter.java

示例3: writeMarshalArgument

import sun.rmi.rmic.newrmic.IndentingWriter; //导入方法依赖的package包/类
/**
 * Writes a snippet of Java code to marshal a value named "name"
 * of type "type" to the java.io.ObjectOutput stream named
 * "stream".
 *
 * Primitive types are marshalled with their corresponding methods
 * in the java.io.DataOutput interface, and objects (including
 * arrays) are marshalled using the writeObject method.
 **/
private static void writeMarshalArgument(IndentingWriter p,
                                         String streamName,
                                         Type type, String name)
    throws IOException
{
    if (type.dimension().length() > 0 || type.asClassDoc() != null) {
        p.p(streamName + ".writeObject(" + name + ")");
    } else if (type.typeName().equals("boolean")) {
        p.p(streamName + ".writeBoolean(" + name + ")");
    } else if (type.typeName().equals("byte")) {
        p.p(streamName + ".writeByte(" + name + ")");
    } else if (type.typeName().equals("char")) {
        p.p(streamName + ".writeChar(" + name + ")");
    } else if (type.typeName().equals("short")) {
        p.p(streamName + ".writeShort(" + name + ")");
    } else if (type.typeName().equals("int")) {
        p.p(streamName + ".writeInt(" + name + ")");
    } else if (type.typeName().equals("long")) {
        p.p(streamName + ".writeLong(" + name + ")");
    } else if (type.typeName().equals("float")) {
        p.p(streamName + ".writeFloat(" + name + ")");
    } else if (type.typeName().equals("double")) {
        p.p(streamName + ".writeDouble(" + name + ")");
    } else {
        throw new AssertionError(type);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:StubSkeletonWriter.java

示例4: writeUnmarshalArgument

import sun.rmi.rmic.newrmic.IndentingWriter; //导入方法依赖的package包/类
/**
 * Writes a snippet of Java code to unmarshal a value of type
 * "type" from the java.io.ObjectInput stream named "stream" into
 * a variable named "name" (if "name" is null, the value is
 * unmarshalled and discarded).
 *
 * Primitive types are unmarshalled with their corresponding
 * methods in the java.io.DataInput interface, and objects
 * (including arrays) are unmarshalled using the readObject
 * method.
 *
 * Returns true if code to invoke readObject was written, and
 * false otherwise.
 **/
private static boolean writeUnmarshalArgument(IndentingWriter p,
                                              String streamName,
                                              Type type, String name)
    throws IOException
{
    boolean readObject = false;

    if (name != null) {
        p.p(name + " = ");
    }

    if (type.dimension().length() > 0 || type.asClassDoc() != null) {
        p.p("(" + type.toString() + ") " + streamName + ".readObject()");
        readObject = true;
    } else if (type.typeName().equals("boolean")) {
        p.p(streamName + ".readBoolean()");
    } else if (type.typeName().equals("byte")) {
        p.p(streamName + ".readByte()");
    } else if (type.typeName().equals("char")) {
        p.p(streamName + ".readChar()");
    } else if (type.typeName().equals("short")) {
        p.p(streamName + ".readShort()");
    } else if (type.typeName().equals("int")) {
        p.p(streamName + ".readInt()");
    } else if (type.typeName().equals("long")) {
        p.p(streamName + ".readLong()");
    } else if (type.typeName().equals("float")) {
        p.p(streamName + ".readFloat()");
    } else if (type.typeName().equals("double")) {
        p.p(streamName + ".readDouble()");
    } else {
        throw new AssertionError(type);
    }

    return readObject;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:StubSkeletonWriter.java


注:本文中的sun.rmi.rmic.newrmic.IndentingWriter.p方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。