/** * Annotates the stream descriptor for the class <code>cl</code>. * * <p><code>AnnotatedObjectOutputStream</code> implements this method as follows: * * <p>This method invokes this stream's {@link #writeAnnotation writeAnnotation} method with the * given cl. * * @param cl the class to annotate * @throws IOException if <code>writeAnnotation</code> throws an <code>IOException</code> * @throws NullPointerException if <code>cl</code> is <code>null</code> **/ @Override protected void annotateClass(Class cl) throws IOException { writeAnnotation(cl); }
public void writeExternal(AnnotatedObjectOutputStream out) throws IOException { //Writes serial version out.writeByte(SERIAL_VERSION); out.writeUnshared(result); out.writeUnshared(exception); }
public void writeExternal(AnnotatedObjectOutputStream out) throws IOException { out.writeByte(SERIAL_VERSION); out.writeByte(buildFlags()); if (_requestObj != null) { out.writeObject(_requestObj); } else { /** write stubClassId, so that the ServerPeer will marsh/unmarsh the method arguments more faster */ out.writeLong(lrmiId); out.writeLong(objectId); out.writeInt(methodOrderId); out.writeLong(remoteClassLoaderId); if (operationPriority == OperationPriority.CUSTOM && targetVersion.greaterOrEquals(PlatformLogicalVersion.v9_7_0)) { //Place holder for dedicated thread pools IOUtils.writeRepetitiveString(out, ""); } Class<?>[] types = invokeMethod.methodTypes; for (int i = 0; i < types.length; i++) { IOUtils.marshalValue(types[i], args[i], out); } } }
/** * First checks that this class wasn't written already, if it does do nothing. * * <p>Else invokes {@link RMIClassLoader#getClassAnnotation RMIClassLoader.getClassAnnotation} * with <code>cl</code> to get the appropriate class annotation string value (possibly * <code>null</code>) and then writes a class annotation string value (possibly * <code>null</code>) to be read by a corresponding <code>AnnotatedObjectInputStream</code> * implementation. * * <p><code>AnnotatedObjectOutputStream</code> implements this method to just write the * annotation value to this stream using {@link ObjectOutputStream#writeUnshared * writeUnshared}. * * <p>A subclass can override this method to write the annotation to a different location. * * @param annotation the class annotation string value (possibly <code>null</code>) to write * @throws IOException if I/O exception occurs writing the annotation **/ protected void writeAnnotation(Class cl) throws IOException { String annotation = support_code_base ? RMIClassLoader.getClassAnnotation(cl) : null; writeUnshared(annotation); }
/** * Overrides the original implementation, tries to save sending class descriptor, first checks * if the class was already sent. If it does send only the class index otherwise send the class * descriptor also. * * @param desc class descriptor to write to the stream. * @throws IOException If an I/O error has occurred. */ @Override protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException { int i = _context.getObjectStreamClassKey(desc); boolean newClass = false; if (i == 0 || !_optimize) { newClass = true; if (_optimize) { i = _nextClassId++; _context.putObjectStreamClassKey(desc, i);// classMap.put(desc, i); } else { i = -1; } } writeInt(i); // write class ID if (newClass) // new class { super.writeClassDescriptor(desc); } }
/** * Annotates the stream descriptor for the proxy class <code>cl</code>. * * <p><code>AnnotatedObjectOutputStream</code> implements this method as follows: * * <p>This method invokes this stream's {@link #writeAnnotation writeAnnotation} method with the * given cl. * * @param cl the proxy class to annotate * @throws IOException if <code>writeAnnotation</code> throws an <code>IOException</code> * @throws NullPointerException if <code>cl</code> is <code>null</code> **/ @Override protected void annotateProxyClass(Class cl) throws IOException { writeAnnotation(cl); }
/** * First checks that this class wasn't written already, if it does do nothing. * * <p>Else invokes {@link RMIClassLoader#getClassAnnotation RMIClassLoader.getClassAnnotation} * with <code>cl</code> to get the appropriate class annotation string value (possibly * <code>null</code>) and then writes a class annotation string value (possibly * <code>null</code>) to be read by a corresponding <code>MarshalInputStream</code> * implementation. * * <p><code>MarshalOutputStream</code> implements this method to just write the annotation value * to this stream using {@link ObjectOutputStream#writeUnshared writeUnshared}. * * <p>A subclass can override this method to write the annotation to a different location. * * @param annotation the class annotation string value (possibly <code>null</code>) to write * @throws IOException if I/O exception occurs writing the annotation **/ @Override protected void writeAnnotation(Class cl) throws IOException { if (_context.containsAnnotation(cl)) return; _context.addAnnotation(cl); super.writeAnnotation(cl); }