Define a class whose instances represent request and reply messages.The class should provide a pair of constructors, one for request messages and the other for reply messages, showing how the request identifier is assigned. It should also provide a method to marshal itself into an array of bytes and to unmarshal an array of bytes into an instance.
What will be an ideal response?
```
private static int next = 0;
private int type private int requestId;
private RemoteObjectRef o;
private int methodId;
private byte arguments[];
public RequestMessage( RemoteObjectRef aRef, int aMethod, byte[] args){
type=0; ... etc.
requestId = next++; // assume it will not run long enough to overflow
}
public RequestMessage(int rId, byte[] result){
type=1; ... etc. requestId = rid; arguments = result;
}
public byte[] marshall() {
// converts itself into an array of bytes and returns it
}
public RequestMessage unmarshall(byte [] message) {
// converts array of bytes into an instance of this class and returns it
}
public int length() { // returns length of marshalled state}
public int getID(){ return requestId;}
public byte[] getArgs(){ return arguments;}
}
```
You might also like to view...
____ are the networks that are either not known or cannot be identified.
A. Untrusted networks B. Trusted networks C. Partner networks D. Internal networks
A sound with higher _____ is perceived to have a higher pitch.
A. volume B. frequency C. fidelity D. sampling rate E. bit depth
The Worksheet Styles button displays formatting options that you can apply to sections of a worksheet.
Answer the following statement true (T) or false (F)
10. What
``` var toys = new Array("car", "doll", "ball", "game"); var lgth = toys.length; ``` a. 4 b. 3 c. 5 d. 15