Skip to content

Commit f4a4776

Browse files
committed
Reformat
1 parent cc82bec commit f4a4776

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

ffm-impl/src/main/java/dev/freya02/discord/zstd/ffm/DiscordZstdFFMDecompressor.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class DiscordZstdFFMDecompressor extends AbstractZstdDecompressor {
2727
private boolean invalidated = false;
2828
private boolean closed = false;
2929

30-
protected DiscordZstdFFMDecompressor(int bufferSizeHint)
31-
{
30+
protected DiscordZstdFFMDecompressor(int bufferSizeHint) {
3231
this.stream = Zstd.ZSTD_createDStream();
3332

3433
int bufferSize = bufferSizeHint == ZSTD_RECOMMENDED_BUFFER_SIZE
@@ -45,8 +44,7 @@ protected DiscordZstdFFMDecompressor(int bufferSizeHint)
4544
}
4645

4746
@Override
48-
public void reset()
49-
{
47+
public void reset() {
5048
if (closed)
5149
throw new IllegalStateException("Decompressor is closed");
5250

@@ -55,8 +53,7 @@ public void reset()
5553
}
5654

5755
@Override
58-
public void close()
59-
{
56+
public void close() {
6057
if (closed)
6158
return;
6259

@@ -71,8 +68,7 @@ public void close()
7168
* and always return non-null decompressed data
7269
*/
7370
@Override
74-
public byte[] decompress(byte[] data)
75-
{
71+
public byte[] decompress(byte[] data) {
7672
if (closed)
7773
throw new IllegalStateException("Decompressor is closed");
7874
if (invalidated)
@@ -83,8 +79,7 @@ public byte[] decompress(byte[] data)
8379
LOG.trace("Decompressing data {}", Arrays.toString(data));
8480

8581
List<byte[]> chunks = new ArrayList<>();
86-
try (Arena arena = Arena.ofConfined())
87-
{
82+
try (Arena arena = Arena.ofConfined()) {
8883
// Copy compressed data to native memory
8984
final MemorySegment inputSegment = MemorySegment.ofArray(data);
9085
final long inputSize = data.length;

jna-impl/src/main/java/dev/freya02/discord/zstd/jna/ZstdJNADecompressor.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ public class ZstdJNADecompressor extends AbstractZstdDecompressor {
2323
private boolean invalidated = false;
2424
private boolean closed = false;
2525

26-
protected ZstdJNADecompressor(int bufferSizeHint)
27-
{
26+
protected ZstdJNADecompressor(int bufferSizeHint) {
2827
this.stream = ZstdJna.INSTANCE.ZSTD_createDStream();
2928

3029
int bufferSize = bufferSizeHint == ZSTD_RECOMMENDED_BUFFER_SIZE
@@ -37,8 +36,7 @@ protected ZstdJNADecompressor(int bufferSizeHint)
3736
}
3837

3938
@Override
40-
public void reset()
41-
{
39+
public void reset() {
4240
if (closed)
4341
throw new IllegalStateException("Decompressor is closed");
4442

@@ -47,8 +45,7 @@ public void reset()
4745
}
4846

4947
@Override
50-
public void close()
51-
{
48+
public void close() {
5249
if (closed)
5350
return;
5451

@@ -63,8 +60,7 @@ public void close()
6360
* and always return non-null decompressed data
6461
*/
6562
@Override
66-
public byte[] decompress(byte[] data)
67-
{
63+
public byte[] decompress(byte[] data) {
6864
if (closed)
6965
throw new IllegalStateException("Decompressor is closed");
7066
if (invalidated)

jni-impl/src/main/java/dev/freya02/discord/zstd/jni/DiscordZstdJNIDecompressor.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class DiscordZstdJNIDecompressor extends AbstractZstdDecompressor {
2020
private boolean invalidated = false;
2121
private boolean closed = false;
2222

23-
protected DiscordZstdJNIDecompressor(int bufferSizeHint)
24-
{
23+
protected DiscordZstdJNIDecompressor(int bufferSizeHint) {
2524
this.zds = createDStream();
2625

2726
int bufferSize = bufferSizeHint == ZSTD_RECOMMENDED_BUFFER_SIZE
@@ -34,8 +33,7 @@ protected DiscordZstdJNIDecompressor(int bufferSizeHint)
3433
}
3534

3635
@Override
37-
public void reset()
38-
{
36+
public void reset() {
3937
if (closed)
4038
throw new IllegalStateException("Decompressor is closed");
4139

@@ -44,8 +42,7 @@ public void reset()
4442
}
4543

4644
@Override
47-
public void close()
48-
{
45+
public void close() {
4946
if (closed)
5047
return;
5148

@@ -54,8 +51,7 @@ public void close()
5451
}
5552

5653
@Override
57-
public byte[] decompress(byte[] data)
58-
{
54+
public byte[] decompress(byte[] data) {
5955
if (closed)
6056
throw new IllegalStateException("Decompressor is closed");
6157
if (invalidated)
@@ -74,8 +70,12 @@ public byte[] decompress(byte[] data)
7470
}
7571

7672
private static native long createDStream();
73+
7774
private static native long freeDStream(long zds);
75+
7876
private static native int DStreamOutSize();
77+
7978
private static native long initDStream(long zds);
79+
8080
private static native byte[] decompressMessage(long zds, byte[] buffer, byte[] input);
8181
}

0 commit comments

Comments
 (0)