HBASE-22611 Close the DataOutputStream object #325
This commit is contained in:
parent
10032a11ba
commit
841b319e4d
|
@ -118,16 +118,17 @@ public class RowIndexCodecV1 extends AbstractDataBlockEncoder {
|
|||
}
|
||||
boolean includesMvcc = decodingCtx.getHFileContext().isIncludesMvcc();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
DataOutputStream out = new DataOutputStream(baos);
|
||||
for (Cell cell : kvs) {
|
||||
KeyValue currentCell = KeyValueUtil.copyToNewKeyValue(cell);
|
||||
out.write(currentCell.getBuffer(), currentCell.getOffset(),
|
||||
currentCell.getLength());
|
||||
if (includesMvcc) {
|
||||
WritableUtils.writeVLong(out, cell.getSequenceId());
|
||||
try (DataOutputStream out = new DataOutputStream(baos)) {
|
||||
for (Cell cell : kvs) {
|
||||
KeyValue currentCell = KeyValueUtil.copyToNewKeyValue(cell);
|
||||
out.write(currentCell.getBuffer(), currentCell.getOffset(),
|
||||
currentCell.getLength());
|
||||
if (includesMvcc) {
|
||||
WritableUtils.writeVLong(out, cell.getSequenceId());
|
||||
}
|
||||
}
|
||||
out.flush();
|
||||
}
|
||||
out.flush();
|
||||
return ByteBuffer.wrap(baos.getBuffer(), 0, baos.size());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue