For example:
I send a byte[] over Socket outputStream using ObjectInput/OutputStream:
ObjectOutputStream myOutput = new ObjectOutputStream(mySocket.getOutputStream()); myOutput.write(myByteArray);At the other end, he use DataInputStream (and may use other InputStream as well) to read:
DataInputStream hisInput = new DataInputStream(hisSocket.getInputStream()); hisInput.read(hisByteArray);
So my question is:
- Will the receiver read the byte[] correctly?
- What about String using writeObject and readUTF?
Info:
- I can only use Java library (JRE8) and is new to Java's Stream.
- I can not expect or force the other side to use what Stream other than knowing that they are not using ObjectInput/OutputStream
- I asked this question because using ObjectInput/OutputStream MAY save me some work, I took advice from my other question.
Byte[]or abyte[]?