提交 60bccc26 编写于 作者: K kohsuke

code should be where it belongs to.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21133 71c3de6d-444a-0410-be80-ed276b4c234a
上级 f263d849
......@@ -7,6 +7,8 @@ import java.io.UnsupportedEncodingException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
/**
* Represents additional features implemented on {@link Channel}.
......@@ -54,6 +56,18 @@ final class Capability implements Serializable {
oos.flush();
}
/**
* The opposite operation of {@link #writePreamble(OutputStream)}.
*/
public static Capability read(InputStream is) throws IOException {
try {
ObjectInputStream ois = new ObjectInputStream(Mode.TEXT.wrap(is));
return (Capability)ois.readObject();
} catch (ClassNotFoundException e) {
throw (Error)new NoClassDefFoundError(e.getMessage()).initCause(e);
}
}
private static final long serialVersionUID = 1L;
static final byte[] PREAMBLE;
......
......@@ -349,12 +349,8 @@ public class Channel implements VirtualChannel, IChannel {
return;
case 2:
try {// capability negotiation
ObjectInputStream ois = new ObjectInputStream(Mode.TEXT.wrap(is));
cap = (Capability)ois.readObject();
} catch (ClassNotFoundException e) {
throw (Error)new NoClassDefFoundError(e.getMessage()).initCause(e);
}
cap = Capability.read(is);
break;
}
ptr[i]=0; // reset
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册