mirror of
https://github.com/corda/corda.git
synced 2025-06-17 14:48:16 +00:00
Fix DataOutputStream#writeUTF
This developer did not read the specs closely enough and missed that the length of the byte array needs to be written out first, so that DataInputStream#readUTF has a chance of reading the string back. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@ -92,6 +92,8 @@ public class DataOutputStream extends OutputStream implements DataOutput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeUTF(String s) throws IOException {
|
public void writeUTF(String s) throws IOException {
|
||||||
out.write(s.getBytes("UTF-8"));
|
byte[] bytes = s.getBytes("UTF-8");
|
||||||
|
writeShort((short)bytes.length);
|
||||||
|
out.write(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user