本文整理汇总了Java中java.rmi.server.UID.read方法的典型用法代码示例。如果您正苦于以下问题:Java UID.read方法的具体用法?Java UID.read怎么用?Java UID.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.rmi.server.UID
的用法示例。
在下文中一共展示了UID.read方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doMessage
import java.rmi.server.UID; //导入方法依赖的package包/类
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out, Object payload ) throws Exception {
System.err.println("Reading message...");
int op = in.read();
switch ( op ) {
case TransportConstants.Call:
// service incoming RMI call
doCall(in, out, payload);
break;
case TransportConstants.Ping:
// send ack for ping
out.writeByte(TransportConstants.PingAck);
break;
case TransportConstants.DGCAck:
UID u = UID.read(in);
break;
default:
throw new IOException("unknown transport op " + op);
}
s.close();
}
示例2: doMessage
import java.rmi.server.UID; //导入方法依赖的package包/类
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out ) throws Exception {
System.err.println("Reading message...");
int op = in.read();
switch ( op ) {
case TransportConstants.Call:
// service incoming RMI call
doCall(in, out);
break;
case TransportConstants.Ping:
// send ack for ping
out.writeByte(TransportConstants.PingAck);
break;
case TransportConstants.DGCAck:
UID.read(in);
break;
default:
throw new IOException("unknown transport op " + op);
}
s.close();
}
示例3: executeCall
import java.rmi.server.UID; //导入方法依赖的package包/类
/**
* @see RemoteCall.executeCall()
*/
public void executeCall() throws Exception {
if (isClosed) {
// rmi.38=Remote call is already closed.
throw new RemoteException(Messages.getString("rmi.38")); //$NON-NLS-1$
}
byte data;
try {
// read input
if ((data = (new DataInputStream(conn.getInputStream())).readByte())
!= CALL_OK) {
// rmi.39=Unknown call status response: {0}
throw new UnmarshalException(Messages.getString("rmi.39", data)); //$NON-NLS-1$
}
// read return value id
getInputStream();
data = oin.readByte();
} catch (UnmarshalException re) {
throw re;
} catch (IOException ioe) {
// rmi.3A=Unable to read call return header:
throw new UnmarshalException(Messages.getString("rmi.3A"), //$NON-NLS-1$
ioe);
}
if (data != RETURN_VAL && data != RETURN_EX) {
// rmi.3B=Unknown call result response: {0}
throw new UnmarshalException(Messages.getString("rmi.3B", data)); //$NON-NLS-1$
}
uid = UID.read(oin);
if (data == RETURN_EX) {
getExceptionFromServer();
}
}
示例4: readDGCAck
import java.rmi.server.UID; //导入方法依赖的package包/类
/**
* Reads a DGCAck message
* @param in
* the {@link java.io.InputStream} to be read
* @throws ProtocolException
* if not able to read the DGCAck
*/
private final void readDGCAck(DataInputStream in) throws ProtocolException {
try {
uid = UID.read(in);
} catch (IOException e) {
throw new ProtocolException("I/O Error Reading the DGCAck");
}
}
示例5: testRead001
import java.rmi.server.UID; //导入方法依赖的package包/类
public final void testRead001() {
try {
byte[] ba = { -5, 67, 99, -111, 125, 124, 33, -11, 45, 63, 52, 14,
21, -38 };
ByteArrayInputStream baops = new ByteArrayInputStream(ba);
DataInputStream dis = new DataInputStream(baops);
uid = UID.read(dis);
assertEquals(uid.toString(), "-4bc9c6f:7d7c21f52d3f340e:15da");
} catch (Throwable e) {
fail("Failed with:" + e);
}
}
示例6: testRead002
import java.rmi.server.UID; //导入方法依赖的package包/类
public final void testRead002() {
try {
byte[] ba = { 5, 67, 0, 33, 125, -124, 33, -11, 45, 63, 52, 0, 0, 0 };
ByteArrayInputStream baops = new ByteArrayInputStream(ba);
DataInputStream dis = new DataInputStream(baops);
uid = UID.read(dis);
assertEquals(uid.toString(), "5430021:7d8421f52d3f3400:0");
} catch (Throwable e) {
fail("Failed with:" + e);
}
}
示例7: testRead003
import java.rmi.server.UID; //导入方法依赖的package包/类
public final void testRead003() {
try {
byte[] ba = { 4, -33, 57, 13, 0, 0, 0, 0, 0, 0, 0, 0, -21, -38 };
ByteArrayInputStream baops = new ByteArrayInputStream(ba);
DataInputStream dis = new DataInputStream(baops);
uid = UID.read(dis);
assertEquals(uid.toString(), "4df390d:0:-1426");
} catch (Throwable e) {
fail("Failed with:" + e);
}
}
示例8: testRead004
import java.rmi.server.UID; //导入方法依赖的package包/类
public final void testRead004() {
byte[] ba = { 0, 0, 0, 0, -22, 124, 33, -11, 55, 25, 1, 111, 99, -99 };
ByteArrayInputStream baops = new ByteArrayInputStream(ba);
DataInputStream dis = new DataInputStream(baops);
try {
uid = UID.read(dis);
} catch (Throwable e) {
fail("Failed with:" + e);
}
assertEquals(uid.toString(), "0:-1583de0ac8e6fe91:639d");
}
示例9: testRead005
import java.rmi.server.UID; //导入方法依赖的package包/类
public final void testRead005() {
byte[] ba = { -5, 67, 99, -111, 125, 38, 33, -11, 45, 63, 52, 14, 21,
-38 };
ByteArrayInputStream baops = new ByteArrayInputStream(ba);
DataInputStream dis = new DataInputStream(baops);
try {
uid = UID.read(dis);
} catch (Throwable e) {
fail("Failed with:" + e);
}
assertEquals(uid.toString(), "-4bc9c6f:7d2621f52d3f340e:15da");
}
示例10: testRead006
import java.rmi.server.UID; //导入方法依赖的package包/类
public final void testRead006() {
byte[] ba = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
ByteArrayInputStream baops = new ByteArrayInputStream(ba);
DataInputStream dis = new DataInputStream(baops);
try {
uid = UID.read(dis);
} catch (Throwable e) {
fail("Failed with:" + e);
}
assertEquals(uid.toString(), "0:0:0");
}
示例11: readID
import java.rmi.server.UID; //导入方法依赖的package包/类
void readID() throws IOException {
ackID = UID.read((DataInput) this);
}
示例12: readObject
import java.rmi.server.UID; //导入方法依赖的package包/类
private void readObject(ObjectInput in)
throws IOException, ClassNotFoundException {
addr = (byte []) in.readObject();
uid = UID.read(in);
}