Skip to content

Commit 3365315

Browse files
Fixed some variables to camelCase
Change-Id: I6471635d0265adc304d38bb9042f734c4710c40a
1 parent 706d2d0 commit 3365315

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

AndroidSocketIO/src/main/java/com/appunite/websocket/WebSocket.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -392,32 +392,32 @@ private void writeHeaders(Uri uri, String secret) throws IOException {
392392
*/
393393
private void doRead() throws IOException, WrongWebsocketResponse,
394394
InterruptedException, NotConnectedException {
395-
int first = mInputStream.readByteOrThrow();
396-
int reserved = first & RESERVED;
395+
final int first = mInputStream.readByteOrThrow();
396+
final int reserved = first & RESERVED;
397397
if (reserved != 0) {
398398
throw new WrongWebsocketResponse(
399399
"Server expected some negotiation that is not supported");
400400
}
401-
boolean fin = (first & FIN) != 0;
402-
int opcode = first & OPCODE;
403-
int second = mInputStream.readByteOrThrow();
404-
boolean payload_mask = (second & PAYLOAD_MASK) != 0;
405-
406-
long payload_len = (second & (~PAYLOAD_MASK));
407-
if (payload_len == 127) {
408-
payload_len = mInputStream.read64Long();
409-
} else if (payload_len == 126) {
410-
payload_len = mInputStream.read16Int();
401+
final boolean fin = (first & FIN) != 0;
402+
final int opcode = first & OPCODE;
403+
final int second = mInputStream.readByteOrThrow();
404+
final boolean payloadMask = (second & PAYLOAD_MASK) != 0;
405+
406+
long payloadLen = (second & (~PAYLOAD_MASK));
407+
if (payloadLen == 127) {
408+
payloadLen = mInputStream.read64Long();
409+
} else if (payloadLen == 126) {
410+
payloadLen = mInputStream.read16Int();
411411
}
412-
Optional<byte[]> masking_key;
413-
if (payload_mask) {
412+
final Optional<byte[]> maskingKey;
413+
if (payloadMask) {
414414
byte[] mask_key = new byte[4];
415415
mInputStream.readBytesOrThrow(mask_key);
416-
masking_key = Optional.of(mask_key);
416+
maskingKey = Optional.of(mask_key);
417417
} else {
418-
masking_key = Optional.absent();
418+
maskingKey = Optional.absent();
419419
}
420-
readPayload(fin, opcode, masking_key, payload_len);
420+
readPayload(fin, opcode, maskingKey, payloadLen);
421421
}
422422

423423
/**
@@ -428,32 +428,32 @@ private void doRead() throws IOException, WrongWebsocketResponse,
428428
* @param fin Indicates that this is the final fragment in a message. The first
429429
* fragment MAY also be the final fragment.
430430
* @param opcode Defines the interpretation of the "Payload data"
431-
* @param masking_key Defines whether the "Payload data" is masked.
432-
* @param payload_len The length of the "Payload data"
431+
* @param maskingKey Defines whether the "Payload data" is masked.
432+
* @param payloadLen The length of the "Payload data"
433433
* @throws WrongWebsocketResponse when there is an error in websocket message
434434
* @throws IOException
435435
* @throws InterruptedException
436436
* @throws NotConnectedException
437437
*/
438438
private void readPayload(boolean fin, int opcode,
439-
Optional<byte[]> masking_key,
440-
long payload_len)
439+
Optional<byte[]> maskingKey,
440+
long payloadLen)
441441
throws WrongWebsocketResponse, IOException, InterruptedException,
442442
NotConnectedException {
443443

444-
if (payload_len > 1024 * 1024 || payload_len < 0) {
444+
if (payloadLen > 1024 * 1024 || payloadLen < 0) {
445445
throw new WrongWebsocketResponse("too large payload");
446446
}
447447
if (!fin) {
448448
// TODO
449449
throw new WrongWebsocketResponse(
450450
"We do not support not continued frames");
451451
}
452-
byte[] payload = new byte[(int) payload_len];
452+
byte[] payload = new byte[(int) payloadLen];
453453
mInputStream.readBytesOrThrow(payload);
454454

455-
if (masking_key.isPresent()) {
456-
maskBuffer(payload, masking_key.get());
455+
if (maskingKey.isPresent()) {
456+
maskBuffer(payload, maskingKey.get());
457457
}
458458

459459
if (opcode == OPCODE_CONTINUED_FRAME) {

0 commit comments

Comments
 (0)