JagArchive

An interface for reading and writing .jag archives, which are used by RuneScape Classic and early versions of RuneScape 2.

Unlike the client, this implementation is case-sensitive. Entry names should therefore be supplied in uppercase for compatibility.

This class is not thread safe.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val size: Int

The number of entries in the archive.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun exists(name: String): Boolean

Checks whether an entry exists.

Link copied to clipboard
fun existsNamed(nameHash: Int): Boolean

Checks whether an entry exists.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun list(): Iterator<Int>

Lists all entries in the archive.

Link copied to clipboard
fun pack(compressedArchive: Boolean, alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT): ByteBuf

Packs a .jag archive into a compressed ByteBuf using the given compression method.

Link copied to clipboard
fun packBest(alloc: ByteBufAllocator = ByteBufAllocator.DEFAULT): ByteBuf

Packs a .jag archive into a compressed ByteBuf. The best compression method for minimising the size of the compressed archive is automatically selected. Note that this does not necessarily correspond to the minimimal amount of RAM usage at runtime.

Link copied to clipboard
fun read(name: String): ByteBuf

Reads an entry.

Link copied to clipboard
fun readNamed(nameHash: Int): ByteBuf

Reads an entry.

Link copied to clipboard
fun remove(name: String)

Deletes an entry. Does nothing if the entry does not exist.

Link copied to clipboard
fun removeNamed(nameHash: Int)

Deletes an entry. Does nothing if the entry does not exist.

Link copied to clipboard
fun write(name: String, buf: ByteBuf)

Writes an entry. If an entry with the same name hash already exists, it is overwritten.

Link copied to clipboard
fun writeNamed(nameHash: Int, buf: ByteBuf)

Writes an entry. If an entry with the same name hash already exists, it is overwritten.