Skip to content

Commit

Permalink
(#137) Fix Dictionary to use asBytes() of Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriciofx committed Feb 5, 2024
1 parent 2d05a6f commit 0f8a1c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,14 @@ public String asString() throws Exception {

@Override
public byte[] asBytes() throws Exception {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ByteArrayOutputStream output = new ByteArrayOutputStream();
if (!this.entries.isEmpty()) {
baos.write(this.asString().getBytes(StandardCharsets.UTF_8));
output.write(this.asString().getBytes(StandardCharsets.UTF_8));
}
if (!this.stream.isEmpty()) {
baos.write("\nstream\n".getBytes(StandardCharsets.UTF_8));
baos.write(this.stream.get(0).value());
baos.write("\nendstream".getBytes(StandardCharsets.UTF_8));
output.write(this.stream.get(0).asBytes());
}
return baos.toByteArray();
return output.toByteArray();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public byte[] value() throws Exception {
@Override
public byte[] asBytes() throws Exception {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write("stream\n".getBytes(StandardCharsets.UTF_8));
baos.write("\nstream\n".getBytes(StandardCharsets.UTF_8));
baos.write(this.bytes.asBytes());
baos.write("\nendstream".getBytes(StandardCharsets.UTF_8));
return baos.toByteArray();
Expand Down

0 comments on commit 0f8a1c4

Please sign in to comment.