Add @JvmStatic and @JvmOverloads to more cache methods

Signed-off-by: Graham <gpe@openrs2.org>
Graham 3 years ago
parent bf12f41faf
commit bcc2fdf48e
  1. 2
      cache/src/main/kotlin/org/openrs2/cache/Cache.kt
  2. 2
      cache/src/main/kotlin/org/openrs2/cache/ChecksumTable.kt
  3. 3
      cache/src/main/kotlin/org/openrs2/cache/DiskStore.kt
  4. 2
      cache/src/main/kotlin/org/openrs2/cache/FlatFileStore.kt
  5. 1
      cache/src/main/kotlin/org/openrs2/cache/JagArchive.kt
  6. 1
      cache/src/main/kotlin/org/openrs2/cache/Js5CompressionType.kt
  7. 1
      cache/src/main/kotlin/org/openrs2/cache/Js5Index.kt
  8. 3
      cache/src/main/kotlin/org/openrs2/cache/Js5MasterIndex.kt
  9. 6
      cache/src/main/kotlin/org/openrs2/cache/Js5Pack.kt
  10. 1
      cache/src/main/kotlin/org/openrs2/cache/Js5Protocol.kt
  11. 1
      cache/src/main/kotlin/org/openrs2/cache/Store.kt
  12. 1
      cache/src/main/kotlin/org/openrs2/cache/VersionList.kt

@ -250,6 +250,7 @@ public class Cache private constructor(
public const val MAX_ARCHIVE: Int = 254
@JvmOverloads
@JvmStatic
public fun open(
root: Path,
alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT,
@ -259,6 +260,7 @@ public class Cache private constructor(
}
@JvmOverloads
@JvmStatic
public fun open(
store: Store,
alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT,

@ -21,6 +21,7 @@ public class ChecksumTable(
}
public companion object {
@JvmStatic
public fun create(store: Store): ChecksumTable {
val table = ChecksumTable()
@ -46,6 +47,7 @@ public class ChecksumTable(
return table
}
@JvmStatic
public fun read(buf: ByteBuf): ChecksumTable {
val table = ChecksumTable()

@ -501,6 +501,7 @@ public class DiskStore private constructor(
}
@JvmOverloads
@JvmStatic
public fun open(root: Path, alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT): Store {
val js5DataPath = dataPath(root)
val legacyDataPath = legacyDataPath(root)
@ -549,6 +550,8 @@ public class DiskStore private constructor(
return DiskStore(root, data, musicData, archives, alloc, legacy)
}
@JvmOverloads
@JvmStatic
public fun create(
root: Path,
alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT,

@ -129,6 +129,7 @@ public class FlatFileStore private constructor(
private const val GROUP_EXTENSION = ".dat"
@JvmOverloads
@JvmStatic
public fun open(root: Path, alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT): Store {
if (!Files.isDirectory(root)) {
throw FileNotFoundException()
@ -138,6 +139,7 @@ public class FlatFileStore private constructor(
}
@JvmOverloads
@JvmStatic
public fun create(root: Path, alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT): Store {
Files.createDirectories(root)
return FlatFileStore(root, alloc)

@ -230,6 +230,7 @@ public class JagArchive : Closeable {
* @param buf the compressed archive.
* @return the unpacked archive.
*/
@JvmStatic
public fun unpack(buf: ByteBuf): JagArchive {
val archive = JagArchive()

@ -41,6 +41,7 @@ public enum class Js5CompressionType {
public companion object {
private val values = values()
@JvmStatic
public fun fromOrdinal(ordinal: Int): Js5CompressionType? {
return if (ordinal >= 0 && ordinal < values.size) {
values[ordinal]

@ -280,6 +280,7 @@ public class Js5Index(
private const val FLAG_LENGTHS = 0x04
private const val FLAG_UNCOMPRESSED_CHECKSUMS = 0x08
@JvmStatic
public fun read(buf: ByteBuf): Js5Index {
val number = buf.readUnsignedByte().toInt()
val protocol = Js5Protocol.fromId(number)

@ -118,6 +118,7 @@ public data class Js5MasterIndex(
public companion object {
private const val SIGNATURE_LENGTH = Whirlpool.DIGESTBYTES + 1
@JvmStatic
public fun create(store: Store): Js5MasterIndex {
val masterIndex = Js5MasterIndex(MasterIndexFormat.ORIGINAL)
@ -181,10 +182,12 @@ public data class Js5MasterIndex(
}
@JvmOverloads
@JvmStatic
public fun read(buf: ByteBuf, format: MasterIndexFormat, key: RSAKeyParameters? = null): Js5MasterIndex {
return read(buf, format, key, true)
}
@JvmStatic
public fun readUnverified(buf: ByteBuf, format: MasterIndexFormat): Js5MasterIndex {
return read(buf, format, null, false)
}

@ -91,6 +91,8 @@ public class Js5Pack private constructor(
}
public companion object {
@JvmOverloads
@JvmStatic
public fun create(
alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT,
unpackedCacheSize: Int = UnpackedCache.DEFAULT_CAPACITY
@ -107,6 +109,8 @@ public class Js5Pack private constructor(
}
}
@JvmOverloads
@JvmStatic
public fun read(
path: Path,
alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT,
@ -117,6 +121,8 @@ public class Js5Pack private constructor(
}
}
@JvmOverloads
@JvmStatic
public fun read(
input: InputStream,
alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT,

@ -12,6 +12,7 @@ public enum class Js5Protocol {
private const val OFFSET = 5
private val values = values()
@JvmStatic
public fun fromId(id: Int): Js5Protocol? {
val ordinal = id - OFFSET
return if (ordinal >= 0 && ordinal < values.size) {

@ -136,6 +136,7 @@ public interface Store : Flushable, Closeable {
* @throws IOException if an underlying I/O error occurs.
*/
@JvmOverloads
@JvmStatic
public fun open(root: Path, alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT): Store {
val hasDataFile = Files.isRegularFile(DiskStore.dataPath(root))
val hasLegacyDataFile = Files.isRegularFile(DiskStore.legacyDataPath(root))

@ -20,6 +20,7 @@ public class VersionList(
public companion object {
private val NAMES = listOf("model", "anim", "midi", "map")
@JvmStatic
public fun read(archive: JagArchive): VersionList {
val files = mutableListOf<List<File>>()

Loading…
Cancel
Save