Background: I'm currently creating an application in which two Java programs communicate over a network using a DataInputStream
and DataOutputStream
.
Before every communication, I'd like to send an indication of what type of data is being sent, so the program knows how to handle it. I was thinking of sending an integer for this, but a byte has enough possible combinations.
So my question is, is Java's DataInputStream
's readByte()
faster than readInt()
?
Also, on the other side, is Java's DataOutputStream
's writeByte()
faster than writeInt()
?