Renamed discard methods to more explicit ByteInput#discardBytes and BitInput#discardBits

This commit is contained in:
Collin Smith 2020-08-08 03:49:36 -07:00
parent 3e6e2c05ce
commit 1868a8c089
2 changed files with 4 additions and 4 deletions

View File

@ -115,14 +115,14 @@ public class BitInput implements Aligned, AlignedReader, UnalignedReader {
return byteInput.bitInput = new BitInput(byteInput, bitsCached, cache, numBits);
}
public BitInput discard(long bits) {
public BitInput discardBits(long bits) {
if (bits < 0) throw new IllegalArgumentException("bits(" + bits + ") < " + 0);
if (bits == 0) return this;
final long startingBitsRead = bitsRead;
final long bytes = bits / Byte.SIZE;
assert bytes <= Integer.MAX_VALUE : "bytes(" + bytes + ") > Integer.MAX_VALUE";
if (bytes > 0) align().discard((int) bytes);
if (bytes > 0) align().discardBytes((int) bytes);
final long overflowBits = (startingBitsRead + bits) - bitsRead;
// checks single byte, multi-byte and expected max value

View File

@ -49,7 +49,7 @@ public class ByteInput implements Aligned, AlignedReader {
return bitInput;
}
public ByteInput discard(int bytes) {
public ByteInput discardBytes(int bytes) {
buffer.skipBytes(bytes);
return this;
}
@ -61,7 +61,7 @@ public class ByteInput implements Aligned, AlignedReader {
* <p/>
* <b>Precondition:</b> {@code signature.length == 2}.
*
* @see #discard(int)
* @see #discardBytes(int)
*/
public ByteInput discardUntil(byte[] signature) {
assert aligned() : "not aligned";