/** * Sets the specified protocol version to be used by this stream. * * @param version * the protocol version to be used. Use a {@code * PROTOCOL_VERSION_x} constant from {@code * java.io.ObjectStreamConstants}. * @throws IllegalArgumentException * if an invalid {@code version} is specified. * @throws IOException * if an I/O error occurs. * @see ObjectStreamConstants#PROTOCOL_VERSION_1 * @see ObjectStreamConstants#PROTOCOL_VERSION_2 */ public void useProtocolVersion(int version) throws IOException { if (!objectsWritten.isEmpty()) { throw new IllegalStateException("Cannot set protocol version when stream in use"); } if (version != ObjectStreamConstants.PROTOCOL_VERSION_1 && version != ObjectStreamConstants.PROTOCOL_VERSION_2) { throw new IllegalArgumentException("Unknown protocol: " + version); } protocolVersion = version; }
/** * Sets the specified protocol version to be used by this stream. * * @param version * the protocol version to be used. Use a {@code * PROTOCOL_VERSION_x} constant from {@code * java.io.ObjectStreamConstants}. * @throws IllegalArgumentException * if an invalid {@code version} is specified. * @throws IOException * if an I/O error occurs. * @see ObjectStreamConstants#PROTOCOL_VERSION_1 * @see ObjectStreamConstants#PROTOCOL_VERSION_2 */ public void useProtocolVersion(int version) throws IOException { if (!objectsWritten.isEmpty()) { throw new IllegalStateException("Cannot set protocol version when stream in use"); } if (version != ObjectStreamConstants.PROTOCOL_VERSION_1 && version != ObjectStreamConstants.PROTOCOL_VERSION_2) { throw new IllegalArgumentException("Unknown protocol: " + version); } protocolVersion = version; }
/** * Sets the specified protocol version to be used by this stream. * * @param version * the protocol version to be used. Use a {@code * PROTOCOL_VERSION_x} constant from {@code * java.io.ObjectStreamConstants}. * @throws IllegalArgumentException * if an invalid {@code version} is specified. * @throws IOException * if an I/O error occurs. * @see ObjectStreamConstants#PROTOCOL_VERSION_1 * @see ObjectStreamConstants#PROTOCOL_VERSION_2 */ public void useProtocolVersion(int version) throws IOException { if (!objectsWritten.isEmpty()) { throw new IllegalStateException("Cannot set protocol version when stream in use"); } if (version != ObjectStreamConstants.PROTOCOL_VERSION_1 && version != ObjectStreamConstants.PROTOCOL_VERSION_2) { throw new IllegalArgumentException("Unknown protocol: " + version); } protocolVersion = version; }
/** * Sets the specified protocol version to be used by this stream. * * @param version * the protocol version to be used. Use a {@code * PROTOCOL_VERSION_x} constant from {@code * java.io.ObjectStreamConstants}. * @throws IllegalArgumentException * if an invalid {@code version} is specified. * @throws IOException * if an I/O error occurs. * @see ObjectStreamConstants#PROTOCOL_VERSION_1 * @see ObjectStreamConstants#PROTOCOL_VERSION_2 */ public void useProtocolVersion(int version) throws IOException { if (!objectsWritten.isEmpty()) { throw new IllegalStateException("Cannot set protocol version when stream in use"); } if (version != ObjectStreamConstants.PROTOCOL_VERSION_1 && version != ObjectStreamConstants.PROTOCOL_VERSION_2) { throw new IllegalArgumentException("Unknown protocol: " + version); } protocolVersion = version; }
/** * Sets the specified protocol version to be used by this stream. * * @param version * the protocol version to be used. Use a {@code * PROTOCOL_VERSION_x} constant from {@code * java.io.ObjectStreamConstants}. * @throws IllegalArgumentException * if an invalid {@code version} is specified. * @throws IOException * if an I/O error occurs. * @see ObjectStreamConstants#PROTOCOL_VERSION_1 * @see ObjectStreamConstants#PROTOCOL_VERSION_2 */ public void useProtocolVersion(int version) throws IOException { if (!objectsWritten.isEmpty()) { throw new IllegalStateException("Cannot set protocol version when stream in use"); } if (version != ObjectStreamConstants.PROTOCOL_VERSION_1 && version != ObjectStreamConstants.PROTOCOL_VERSION_2) { throw new IllegalArgumentException("Unknown protocol: " + version); } protocolVersion = version; }
/** * Sets the specified protocol version to be used by this stream. * * @param version * the protocol version to be used. Use a {@code * PROTOCOL_VERSION_x} constant from {@code * java.io.ObjectStreamConstants}. * @throws IllegalArgumentException * if an invalid {@code version} is specified. * @throws IOException * if an I/O error occurs. * @see ObjectStreamConstants#PROTOCOL_VERSION_1 * @see ObjectStreamConstants#PROTOCOL_VERSION_2 */ public void useProtocolVersion(int version) throws IOException { if (!objectsWritten.isEmpty()) { throw new IllegalStateException("Cannot set protocol version when stream in use"); } if (version != ObjectStreamConstants.PROTOCOL_VERSION_1 && version != ObjectStreamConstants.PROTOCOL_VERSION_2) { throw new IllegalArgumentException("Unknown protocol: " + version); } protocolVersion = version; }
/** * Sets the specified protocol version to be used by this stream. * * @param version * the protocol version to be used. Use a {@code * PROTOCOL_VERSION_x} constant from {@code * java.io.ObjectStreamConstants}. * @throws IllegalArgumentException * if an invalid {@code version} is specified. * @throws IOException * if an I/O error occurs. * @see ObjectStreamConstants#PROTOCOL_VERSION_1 * @see ObjectStreamConstants#PROTOCOL_VERSION_2 */ public void useProtocolVersion(int version) throws IOException { if (!objectsWritten.isEmpty()) { throw new IllegalStateException("Cannot set protocol version when stream in use"); } if (version != ObjectStreamConstants.PROTOCOL_VERSION_1 && version != ObjectStreamConstants.PROTOCOL_VERSION_2) { throw new IllegalArgumentException("Unknown protocol: " + version); } protocolVersion = version; }
/** * Sets the specified protocol version to be used by this stream. * * @param version * the protocol version to be used. Use a {@code * PROTOCOL_VERSION_x} constant from {@code * java.io.ObjectStreamConstants}. * @throws IllegalArgumentException * if an invalid {@code version} is specified. * @throws IOException * if an I/O error occurs. * @see ObjectStreamConstants#PROTOCOL_VERSION_1 * @see ObjectStreamConstants#PROTOCOL_VERSION_2 */ public void useProtocolVersion(int version) throws IOException { if (!objectsWritten.isEmpty()) { throw new IllegalStateException("Cannot set protocol version when stream in use"); } if (version != ObjectStreamConstants.PROTOCOL_VERSION_1 && version != ObjectStreamConstants.PROTOCOL_VERSION_2) { throw new IllegalArgumentException("Unknown protocol: " + version); } protocolVersion = version; }