Graham
977dd0bd93
Check that we read exactly uncompressedLen bytes
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
107c432e65
Rename NONE to UNCOMPRESSED
...
This is the name used by Jagex.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
8d35b5010a
Add functions for quickly checking if a XTEA key is valid
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
88175e798f
Remove debug println from Js5IndexTest
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
15d359429e
Add alloc parameter to Store.open()
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
a2d41d924f
Change cache's crypto dependency to an API dependency
...
The XteaKey class is used in method signatures.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
89accc8b26
Rename root to ROOT
...
Path is immutable.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
0afc7a563d
Add Store.open() method
...
It automatically determines whether to use a DiskStore or FlatFileStore.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
d2ee9d3b8b
Check that all decompression algorithms throw IOException on failure
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
0d384fa8f2
Throw IOException for all JS5 decompression errors
...
Should be nicer than the mixture of exception types we used before.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
78f8069177
Add method for stripping the version trailer from a ByteBuf
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
e764403cb2
Add tests for corrupt containers
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
b51b2f5e77
Cache values() array in enums
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
d5240e3e42
Use assertions for conditions we never expect to hit
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
ec4f8b59c9
Use default ByteBufAllocator in unit tests
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
4fdedf298b
Add support for colliding name hashes to Js5Index
...
Annoyingly, the 876 and latest RuneScape 3 cache both have collisions.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
f984f357d8
Add Js5Index implementation
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
8bed0fc875
Rename getOrCreateIndex to createOrGetIndex
...
I think this flows slightly better.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
0af11d75c3
Add flag to disable encryption of uncompressed containers by default
...
These don't work in the 550 client due to a bug.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
e5e9ece098
Fix JS5 uncompression of large GZIP-compressed files
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
7ab567b7b9
Optimise DiskStore::list
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
1455379f20
Document thread safety of DiskStore and FlatFileStore
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
20d6d73d30
Check {read,write}BufferSize are both zero or positive
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
5e447f31d6
Free readBuffer if the writeBuffer allocation fails
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
8cdd33a1dd
Replace exists() with isDirectory() for consistency
...
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
9f1b2dbc29
Add BufferedFileChannel
...
Similar to the equivalent class in the client.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
2dda87fa4a
Improve testListGroups()
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
ad5f714982
Add testBounds() to DiskStoreTest
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
9de0b26da4
Throw exception in remove() if group ID is negative
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
63a8f5534e
Add netty-buffer API dependency to the cache module
...
The public interface of the cache module uses ByteBufs.
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
cea016d4ef
Add low-level cache interface
...
Unit tests to follow - I've been working on these classes for a few days
now, so I wanted to make sure they get backed up in the repository.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
e7ad4b92ff
Group test files by test
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
d801e5fda6
Re-use length variables in the Js5Compression code
4 years ago
Graham
24db41a74e
Add gzip headers to containers
...
The headerless gzip compression is only used for pack200 files, not
containers.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
ce97775663
Reduce use of ByteBuf{Input,Output}Stream in Js5Compression
...
Probably slightly more efficient.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
3f59e1764c
Store individual XteaKey components separately
...
This allows us to make them private (rather than internal) and the type
as a whole is immutable.
It does mean we need to convert the key to an IntArray every time we use
it now. However, I hope that the JVM will be smart enough to inline the
toIntArray() method and also smart enough to realise it doesn't escape,
allowing it to allocate it on the stack rather than the heap.
This commit also adds methods for converting XteaKeys to hex, and
converting from hex/integer arrays to an XteaKey object.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
58335ca6d0
Add JS5 compression/encryption implementation
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago