I've got a function:
public static Object receviceSigAndData(Socket s) {
byte[] data = null;
try {
DataInputStream din2 = new DataInputStream(s.getInputStream());
int sig_len = 0;
sig_len = din2.readInt();
byte[] sig = new byte[sig_len];
din2.readFully(sig);
int data_len = 0;
data_len = din2.readInt();
data = new byte[data_len];
dsa.update(data);
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return (Object) data;
}
The function returns an Object
. If the Object
is a byte array, how do I cast the Object
to byte[]
?
byte[] b = (?)receviceSigAndData(socket);
Thanks