IO: Open TemporaryBuffer.Heap in try-with-resource
Change-Id: I78a947fd1263b47b3df17bcc6e9b32497e68dd4a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
f5614e03f1
commit
a0f69ff387
|
@ -203,12 +203,13 @@ public static ByteBuffer readWholeStream(InputStream in, int sizeHint)
|
|||
if (last < 0)
|
||||
return ByteBuffer.wrap(out, 0, pos);
|
||||
|
||||
@SuppressWarnings("resource" /* java 7 */)
|
||||
TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(Integer.MAX_VALUE);
|
||||
tmp.write(out);
|
||||
tmp.write(last);
|
||||
tmp.copy(in);
|
||||
return ByteBuffer.wrap(tmp.toByteArray());
|
||||
try (TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(
|
||||
Integer.MAX_VALUE)) {
|
||||
tmp.write(out);
|
||||
tmp.write(last);
|
||||
tmp.copy(in);
|
||||
return ByteBuffer.wrap(tmp.toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue