public void useProtocolVersion(int version) throws IOException { if (out instanceof ObjectOutputStream) { ((ObjectOutputStream)out).useProtocolVersion(version); } }
public void useProtocolVersion(int version) throws IOException { if (out instanceof ObjectOutputStream) { ((ObjectOutputStream)out).useProtocolVersion(version); } }
/** * Transforms the specified {@link Operation} into a byte array. */ public byte[] encode( Operation op ) { ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { ObjectOutputStream out = new ObjectOutputStream( bout ); out.useProtocolVersion( ObjectStreamConstants.PROTOCOL_VERSION_2 ); Operation.serialize( op, out ); out.flush(); out.close(); } catch ( IOException e ) { throw ( InternalError ) new InternalError().initCause( e ); } catch ( ClassNotFoundException cnfe ) { throw ( InternalError ) new InternalError().initCause( cnfe ); } return bout.toByteArray(); }