Skip to content

Commit ec9e4f1

Browse files
committed
Cleaned up code
1 parent 9559fb0 commit ec9e4f1

File tree

9 files changed

+10
-22
lines changed

9 files changed

+10
-22
lines changed

src/main/java/com/hivemq/client/internal/mqtt/codec/decoder/mqtt3/Mqtt3SubAckDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class Mqtt3SubAckDecoder implements MqttMessageDecoder {
6161
final int packetIdentifier = in.readUnsignedShort();
6262

6363
final int returnCodeCount = in.readableBytes();
64-
final ImmutableList.Builder<Mqtt3SubAckReturnCode> returnCodesBuilder = ImmutableList.builder();
64+
final ImmutableList.Builder<Mqtt3SubAckReturnCode> returnCodesBuilder = ImmutableList.builder(returnCodeCount);
6565
for (int i = 0; i < returnCodeCount; i++) {
6666
final Mqtt3SubAckReturnCode returnCode = Mqtt3SubAckReturnCode.fromCode(in.readUnsignedByte());
6767
if (returnCode == null) {

src/main/java/com/hivemq/client/internal/mqtt/datatypes/MqttBinaryData.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ public class MqttBinaryData {
3434
public static final int MAX_LENGTH = 65_535;
3535
public static final int EMPTY_LENGTH = 2;
3636

37-
private MqttBinaryData() {
38-
}
37+
private MqttBinaryData() {}
3938

4039
/**
4140
* Decodes binary data from the given byte buffer at the current reader index.
4241
*
4342
* @param byteBuf the byte buffer to decode from.
4443
* @return the decoded binary data or null if there are not enough bytes in the byte buffer.
4544
*/
46-
@Nullable
47-
public static byte[] decode(final @NotNull ByteBuf byteBuf) {
45+
public static @Nullable byte[] decode(final @NotNull ByteBuf byteBuf) {
4846
if (byteBuf.readableBytes() < 2) {
4947
return null;
5048
}
@@ -64,8 +62,7 @@ public static byte[] decode(final @NotNull ByteBuf byteBuf) {
6462
* @param direct whether the created byte buffer should be direct.
6563
* @return the decoded binary data or null if there are not enough bytes in the byte buffer.
6664
*/
67-
@Nullable
68-
public static ByteBuffer decode(final @NotNull ByteBuf byteBuf, final boolean direct) {
65+
public static @Nullable ByteBuffer decode(final @NotNull ByteBuf byteBuf, final boolean direct) {
6966
if (byteBuf.readableBytes() < 2) {
7067
return null;
7168
}
@@ -157,5 +154,4 @@ public static int encodedLength(final @NotNull byte[] binary) {
157154
public static int encodedLength(final @NotNull ByteBuffer byteBuffer) {
158155
return 2 + byteBuffer.remaining();
159156
}
160-
161157
}

src/main/java/com/hivemq/client/internal/mqtt/datatypes/MqttVariableByteInteger.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public class MqttVariableByteInteger {
4040
public static final int FOUR_BYTES_MAX_VALUE = (1 << (VALUE_BITS * 4)) - 1;
4141
public static final int MAXIMUM_PACKET_SIZE_LIMIT = 1 + 4 + FOUR_BYTES_MAX_VALUE;
4242

43-
private MqttVariableByteInteger() {
44-
}
43+
private MqttVariableByteInteger() {}
4544

4645
/**
4746
* Decodes a variable byte integer from the given byte buffer at the current reader index.
@@ -129,5 +128,4 @@ public static int encodedLength(final int value) {
129128
}
130129
return length;
131130
}
132-
133131
}

src/main/java/com/hivemq/client/internal/mqtt/handler/publish/outgoing/MqttPublishFlowables.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ public class MqttPublishFlowables extends Flowable<Flowable<MqttPublishWithFlow>
4141
private long requested;
4242

4343
@Inject
44-
MqttPublishFlowables() {
45-
}
44+
MqttPublishFlowables() {}
4645

4746
@Override
4847
protected void subscribeActual(final @NotNull Subscriber<? super Flowable<MqttPublishWithFlow>> s) {

src/main/java/com/hivemq/client/internal/mqtt/handler/publish/outgoing/MqttTopicAliasAutoMapping.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private void swapNewer(final @NotNull Entry entry, final long priority) {
153153
return s.toString();
154154
}
155155

156-
public static class Entry {
156+
static class Entry {
157157

158158
int topicAlias;
159159
long used; // number of accesses, decays over time

src/main/java/com/hivemq/client/internal/mqtt/message/disconnect/mqtt3/Mqtt3DisconnectView.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ public class Mqtt3DisconnectView implements Mqtt3Disconnect {
4040

4141
private Mqtt3DisconnectView() {}
4242

43-
public @NotNull MqttDisconnect getDelegate() {
44-
return DELEGATE;
45-
}
46-
4743
@Override
4844
public @NotNull String toString() {
4945
return "MqttDisconnect{}";

src/main/java/com/hivemq/client/internal/mqtt/message/subscribe/MqttSubscription.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public boolean isRetainAsPublished() {
7373
return retainAsPublished;
7474
}
7575

76-
public @NotNull String toAttributeString() {
76+
private @NotNull String toAttributeString() {
7777
return "topicFilter=" + topicFilter + ", qos=" + qos + ", noLocal=" + noLocal + ", retainHandling=" +
7878
retainHandling + ", retainAsPublished=" + retainAsPublished;
7979
}

src/main/java/com/hivemq/client/internal/rx/RxFutureConverter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
*/
3333
public class RxFutureConverter {
3434

35-
private RxFutureConverter() {
36-
}
35+
private RxFutureConverter() {}
3736

3837
public static @NotNull CompletableFuture<Void> toFuture(final @NotNull Completable completable) {
3938
return new RxJavaCompletableFuture(completable);

src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/Mqtt5Subscription.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public interface Mqtt5Subscription {
5151
boolean DEFAULT_RETAIN_AS_PUBLISHED = false;
5252

5353
/**
54-
* Creatse a builder for a Subscription.
54+
* Creates a builder for a Subscription.
5555
*
5656
* @return the created builder.
5757
*/

0 commit comments

Comments
 (0)