Hey people, wondering if anyone can help me out here...
the situation is this, I am designing a RMI prog whereby the client sends a string in a byte array to the server.
the interface is this for the particular method
I cant seem to convert my string into the byte array. here is my method to try and do so on the client
I am just wondering if I am near to converting the string to correct way. in my above code i dunno where to insert the StringValue so it gets converted into a byte[] bytes
Thanks in advance for any help you people can give me.
the situation is this, I am designing a RMI prog whereby the client sends a string in a byte array to the server.
the interface is this for the particular method
Code:
void putObjectString(int key, byte [] b) throws java.rmi.RemoteException;
/**
* @param key identifies the object in the store (not -1)
* @param b the object string sent from the client
* @exception java.rmi.RemoteException if there is a
* problem.
*/
Code:
private void callsendObject()
{
try
{
byte[] bytes;
int keyInteger = Integer.parseInt(inputKey.getText()); // get key from GUI
String StringValue = inputString.getText(); // get string from GUI
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
ObjectOutputStream writebyte = new ObjectOutputStream(byteStream);
writebyte.write(bytes);
service.putObjectString(keyInteger, bytes);
}
catch(Exception e)
{
display.append("Error sending object. " + e);
}
}
Thanks in advance for any help you people can give me.