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)
|
if (last < 0)
|
||||||
return ByteBuffer.wrap(out, 0, pos);
|
return ByteBuffer.wrap(out, 0, pos);
|
||||||
|
|
||||||
@SuppressWarnings("resource" /* java 7 */)
|
try (TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(
|
||||||
TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(Integer.MAX_VALUE);
|
Integer.MAX_VALUE)) {
|
||||||
tmp.write(out);
|
tmp.write(out);
|
||||||
tmp.write(last);
|
tmp.write(last);
|
||||||
tmp.copy(in);
|
tmp.copy(in);
|
||||||
return ByteBuffer.wrap(tmp.toByteArray());
|
return ByteBuffer.wrap(tmp.toByteArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue