mirror of
https://github.com/samsonjs/media.git
synced 2026-04-09 11:55:46 +00:00
Satisfy nullness checker correctness by using local variable
This commit is contained in:
parent
c4c4ef9670
commit
58d8850b21
1 changed files with 7 additions and 7 deletions
|
|
@ -59,15 +59,15 @@ public class SimpleDecoderOutputBuffer extends DecoderOutputBuffer {
|
|||
* @return The {@link #data} buffer, for convenience.
|
||||
*/
|
||||
public ByteBuffer grow(int newSize) {
|
||||
Assertions.checkNotNull(data);
|
||||
Assertions.checkArgument(newSize >= data.limit());
|
||||
final ByteBuffer newData = ByteBuffer.allocateDirect(newSize).order(ByteOrder.nativeOrder());
|
||||
final int restorePosition = data.position();
|
||||
data.position(0);
|
||||
newData.put(data);
|
||||
ByteBuffer oldData = Assertions.checkNotNull(this.data);
|
||||
Assertions.checkArgument(newSize >= oldData.limit());
|
||||
ByteBuffer newData = ByteBuffer.allocateDirect(newSize).order(ByteOrder.nativeOrder());
|
||||
int restorePosition = oldData.position();
|
||||
oldData.position(0);
|
||||
newData.put(oldData);
|
||||
newData.position(restorePosition);
|
||||
newData.limit(newSize);
|
||||
data = newData;
|
||||
this.data = newData;
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue