Skip to content

Commit

Permalink
Fix readBytes and writeBytes methods in fastjson2 (apache#13968)
Browse files Browse the repository at this point in the history
  • Loading branch information
finefuture authored and Will-well committed Apr 9, 2024
1 parent a5d0731 commit db699a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public String readUTF() throws IOException {

@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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ public void writeUTF(String v) throws IOException {

@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);
}

Expand Down

0 comments on commit db699a4

Please sign in to comment.