Fix readBytes and writeBytes methods in fastjson2 (#13968)
This commit is contained in:
parent
afcf04d6e3
commit
164aebf6ed
|
|
@ -91,7 +91,7 @@ public class FastJson2ObjectInput implements ObjectInput {
|
|||
|
||||
@Override
|
||||
public byte[] readBytes() throws IOException {
|
||||
int length = is.read();
|
||||
int length = readLength();
|
||||
byte[] bytes = new byte[length];
|
||||
int read = is.read(bytes, 0, length);
|
||||
if (read != length) {
|
||||
|
|
|
|||
|
|
@ -89,13 +89,13 @@ public class FastJson2ObjectOutput implements ObjectOutput {
|
|||
|
||||
@Override
|
||||
public void writeBytes(byte[] b) throws IOException {
|
||||
os.write(b.length);
|
||||
writeLength(b.length);
|
||||
os.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(byte[] b, int off, int len) throws IOException {
|
||||
os.write(len);
|
||||
writeLength(len);
|
||||
os.write(b, off, len);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue