Graham
0666df686c
Add Base37 implementation
2 years ago
Graham
21560b1afd
Ignore fsync on directory failures
...
It isn't supported on some platforms, so there's not much we can do if
it does fail.
Signed-off-by: Graham <gpe@openrs2.org>
3 years ago
Graham
f7e194dfa6
Improve atomicWrite
...
We fsync the temp file before doing the atomic move, which I think is
necessary if the underlying filesystem re-orders the operations (e.g. if
the atomic move is performed before the writes to the temp file have
been flushed to disk).
Similarly we fsync the parent dir before returning. For a single atomic
write in isolation this probably isn't important, but probably is useful
if a sequence of atomic writes is performed in order.
Signed-off-by: Graham <gpe@openrs2.org>
3 years ago
Graham
5cbaf55dd6
Add hash function used by pre-JS5 caches
...
Signed-off-by: Graham <gpe@openrs2.org>
3 years ago
Graham
65194fae43
Rename poll to removeFirstOrNull
...
This is more consistent with the Kotlin standard library.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
2b9f423e9a
Remove unused Iterable extensions
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
49e5781288
Add addAll and clear methods to UniqueQueue
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
81e665e9d8
Add UniqueQueue
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
1954f408e7
Replace deprecated capitalize() function
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
b37e4d0d0b
Use alternatives for most methods deprecated in Kotlin 1.5
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
6498d39306
Add Gradle 7 version catalog
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
359891c01e
Convert all test objects to classes
...
This is required for IDEA to display the run test icon in the gutter.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
30828308b2
Replace assertThrows with assertFailsWith
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
22c1b8a183
Use useTempFile extension method in atomicWrite
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
0b43e26d36
Remove redundant toList() calls after sorted()
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
f143eef142
Move Kotlin files from src/{main,test}/java to src/{main,test}/kotlin
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
ce5b76ef0f
Rename dev.openrs2 package to org.openrs2
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
192d5b9e8d
Resolve inspections
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
b2a7464da2
Use Kotlin's new ArrayDeque class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
3f8e1a1951
Add FlatFileStoreTest
...
This commit fixes some bugs in FlatFileStore at the same time.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
232ba32bbd
Enable explicit API mode
...
This already caught some cases of public members that should have been
private and one case where the inferred type was too specific.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
ada90fb027
Add DiskStore tests
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
cec68723a4
Add Cp1252Charset contains test
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
eef8fc1f0c
Improve Cp1252Charset.contains()
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
2525501901
Add ModifiedUtf8Charset
...
Will be used by the packclass implementation. Like Cp1252Charset, the
JDK isn't guaranteed to provide an implementation of this charset.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
7ab3b3d335
Add method for calculating the K&R hash code of a CP-1252-encoded string
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
be7cc9ac8a
Add Cp1252Charset
...
Slightly different to the standard implementation, as like the client it
considers NUL to be an unmappable character. (Furthermore, the standard
implementation isn't in StandardCharsets.)
It also provides fast methods for encoding/decoding a single byte/char
at a time.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
7179743f5d
Add fsync() extension method
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
c3715d7320
Add useTempFile extension methods
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
8370ad104e
Write files atomically
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
eef6d31753
Replace org.junit.jupiter.api.Test with kotlin.test.Test
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
ccf7056a93
Use private companion objects where possible
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
0206bbd4b2
Set DeterministicJarOutputStream's default compression level to 9
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
8685d2b2dc
Remove unused DeterministicJarOutputStream methods
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
10145fdb43
Add Sequence<JarEntry> extension property to JarInputStream
...
This improves the readability of code that iterates through all entries
in a jar.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Scu11
26348b8a2e
Move Library#write methods to dedicated classes
...
Signed-off-by: Scu11 <scu11@openrs2.dev>
5 years ago
Graham
9a1c0e9caf
Add DeterministicJarOutputStreamTest
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
958fbc03ba
Add IterableUtilsTest
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
972d3cebc1
Add ForestDisjointSetTest
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
1c539f22fe
Add DisjointSet and ForestDisjointSet documentation
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
54aa9b738c
Add testFlush() to SkipOutputStreamTest
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
fced5610a5
Add SkipOutputStreamTest
5 years ago
Graham
09f17d246b
Add additional removeFirst() variants to IterableUtils
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
465078256f
Rename common module to util again
...
As I'm splitting it up into smaller modules (e.g. compress and crypto) I
think util is a more appropriate name for the remainder.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
e05653cdcc
Rename util to common
5 years ago
Graham
ec58c75ab4
Add kotlin-inline-logger dependency
5 years ago
Graham
b25f3c0c58
Convert ForestDisjointSet to Kotlin
5 years ago
Graham
7a0f94dbde
Convert elements and partitions to properties
5 years ago
Graham
c0836e11f6
Convert DisjointSet to Kotlin
5 years ago
Graham
429867e3af
Convert SkipOutputStream to Kotlin
...
This commit also changes the skipBytes logic slightly to avoid the need
to modify the off/len arguments, which is not possible in Kotlin.
5 years ago