You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
752 B
37 lines
752 B
/*
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
class ByteBufferTest {
|
|
|
|
class ByteBuffer {
|
|
byte[] bufferBytes;
|
|
|
|
int limit = 10;
|
|
int pos = 0;
|
|
|
|
public int getInt() {
|
|
return bufferBytes[pos++];
|
|
}
|
|
|
|
public int remaining() {
|
|
return limit - pos;
|
|
}
|
|
}
|
|
|
|
public static int[] decodeMobileOnly(ByteBuffer buffer) {
|
|
int[] dataUsage = new int[3];
|
|
dataUsage[0] = buffer.getInt();
|
|
return dataUsage;
|
|
}
|
|
|
|
// don't hoist remaining()
|
|
void inner_change_don_hoist(ByteBuffer byteBuffer) {
|
|
while (byteBuffer.remaining() > 0) {
|
|
decodeMobileOnly(byteBuffer);
|
|
}
|
|
}
|
|
}
|