mirror of
https://github.com/corda/corda.git
synced 2025-03-16 17:15:19 +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:
parent
759a08bb54
commit
209f2a3aff
@ -92,6 +92,8 @@ public class DataOutputStream extends OutputStream implements DataOutput {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user