Java Code Examples for sun.rmi.rmic.newrmic.IndentingWriter#p()
The following examples show how to use
sun.rmi.rmic.newrmic.IndentingWriter#p() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StubSkeletonWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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("});"); } }
Example 2
Source File: StubSkeletonWriter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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("});"); } }
Example 3
Source File: StubSkeletonWriter.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * 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("});"); } }
Example 4
Source File: StubSkeletonWriter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 5
Source File: StubSkeletonWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 6
Source File: StubSkeletonWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 7
Source File: StubSkeletonWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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("};"); }
Example 8
Source File: StubSkeletonWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 9
Source File: StubSkeletonWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 10
Source File: StubSkeletonWriter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 11
Source File: StubSkeletonWriter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 12
Source File: StubSkeletonWriter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 13
Source File: StubSkeletonWriter.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 14
Source File: StubSkeletonWriter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 15
Source File: StubSkeletonWriter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 16
Source File: StubSkeletonWriter.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 17
Source File: StubSkeletonWriter.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 18
Source File: StubSkeletonWriter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 19
Source File: StubSkeletonWriter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 20
Source File: StubSkeletonWriter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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("};"); }