Skip to content

Commit

Permalink
Puffin: Inline PuffinWriter.writeFully (apache#5088)
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi authored and nkeshavaprakash committed Jul 10, 2022
1 parent bb3fc33 commit 86afe8f
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void add(Blob blob) {
PuffinCompressionCodec codec = MoreObjects.firstNonNull(blob.requestedCompression(), defaultBlobCompression);
ByteBuffer rawData = PuffinFormat.compress(codec, blob.blobData());
int length = rawData.remaining();
writeFully(rawData);
IOUtil.writeFully(outputStream, rawData);
writtenBlobsMetadata.add(new BlobMetadata(blob.type(), blob.inputFields(), fileOffset, length,
codec.codecName(), blob.properties()));
} catch (IOException e) {
Expand Down Expand Up @@ -132,7 +132,7 @@ private void writeFooter() throws IOException {
ByteBuffer footerPayload = PuffinFormat.compress(footerCompression, footerJson);
outputStream.write(MAGIC);
int footerPayloadLength = footerPayload.remaining();
writeFully(footerPayload);
IOUtil.writeFully(outputStream, footerPayload);
PuffinFormat.writeIntegerLittleEndian(outputStream, footerPayloadLength);
writeFlags();
outputStream.write(MAGIC);
Expand All @@ -150,10 +150,6 @@ private void writeFlags() throws IOException {
}
}

private void writeFully(ByteBuffer buffer) throws IOException {
IOUtil.writeFully(outputStream, buffer);
}

public long footerSize() {
return footerSize.orElseThrow(() -> new IllegalStateException("Footer not written yet"));
}
Expand Down

0 comments on commit 86afe8f

Please sign in to comment.