Interface Wad

All Superinterfaces:
Iterable<WadEntry>
All Known Implementing Classes:
WadBuffer, WadFile, WadMap

public interface Wad extends Iterable<WadEntry>
Base interface for all WAD file type implementations for reading and writing to WAD structures, either in memory or on disk.

All entries in a WAD are abstracted as WadEntry objects, which contain the name and offsets for the corresponding data in a WAD file. Note that there may be several entries in a WAD that have the same name; entry "equality" should be determined by name, size and offset.

Entries are by no means attached to their source WADs. Attempting to retrieve content from one WAD using entry data from another WAD may have unintended consequences!

There may be some implementations of this structure that do not support certain operations, so in those cases, those methods may throw an UnsupportedOperationException. Also, certain implementations may be more suited for better tasks, so be sure to figure out which implementation suits your needs!

Most of the common methods are "defaulted" in this interface. Implementors are encouraged to override these if your implementation can provide a more performant version than the one-size-fits-all methods here.

All methods in Wad implementations cannot be guaranteed to be thread-safe.

Author:
Matthew Tropiano
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Internal WAD type.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte[]
     
    static final WadEntry[]
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default WadEntry
    addData(String entryName, byte[] data)
    Adds data to this Wad, using entryName as the name of the new entry.
    default <BO extends BinaryObject>
    WadEntry
    addData(String entryName, BO data)
    Adds data to this Wad, using entryName as the name of the new entry.
    default <BO extends BinaryObject>
    WadEntry
    addData(String entryName, BO[] data)
    Adds data to this Wad, using entryName as the name of the new entry.
    default WadEntry
    addData(String entryName, File fileToAdd)
    Adds data to this Wad, using entryName as the name of the new entry.
    default WadEntry
    addData(String entryName, InputStream in)
    Adds data to this Wad, using entryName as the name of the new entry.
    default WadEntry
    addData(String entryName, InputStream in, int maxLength)
    Adds data to this Wad, using entryName as the name of the new entry.
    default <TO extends TextObject>
    WadEntry
    addData(String entryName, TO data, Charset encoding)
    Adds data to this Wad, using entryName as the name of the new entry.
    default WadEntry
    addDataAt(int index, String entryName, byte[] data)
    Adds data to this Wad at a particular entry offset, using entryName as the name of the entry.
    default <BO extends BinaryObject>
    WadEntry
    addDataAt(int index, String entryName, BO data)
    Adds data to this Wad at a particular entry offset, using entryName as the name of the entry.
    default <BO extends BinaryObject>
    WadEntry
    addDataAt(int index, String entryName, BO[] data)
    Adds data to this Wad at a particular entry offset, using entryName as the name of the entry.
    default WadEntry
    addDataAt(int index, String entryName, File fileToAdd)
    Adds data to this Wad, using entryName as the name of the new entry.
    default WadEntry
    addDataAt(int index, String entryName, InputStream in)
    Adds data to this Wad at a particular entry offset, using entryName as the name of the entry.
    addDataAt(int index, String entryName, InputStream in, int maxLength)
    Adds data to this Wad at a particular entry offset, using entryName as the name of the entry.
    default <TO extends TextObject>
    WadEntry
    addDataAt(int index, String entryName, TO data, Charset encoding)
    Adds data to this Wad at a particular entry offset, using entryName as the name of the entry.
    default WadEntry
    addEntry(String entryName, int offset, int length)
    Adds a new entry to the Wad, but with an explicit offset and size.
    default WadEntry
    Adds a new entry to the Wad.
    default WadEntry
    addEntryAt(int index, String entryName, int offset, int length)
    Adds a new entry to the Wad at a specific index, but with an explicit offset and size.
    addEntryAt(int index, WadEntry entry)
    Adds a new entry to the Wad.
    default void
    addFrom(Wad source, int startIndex, int maxLength)
    Takes entries and their data from another Wad and adds it to this one.
    default void
    addFrom(Wad source, WadEntry... entries)
    Takes entries and their data from another Wad and adds it to this one.
    default void
    addFromAt(int destIndex, Wad source, int startIndex, int maxLength)
    Takes entries and their data from another Wad and adds it to this one at a specific index.
    default void
    addFromAt(int destIndex, Wad source, WadEntry... entries)
    Takes entries and their data from another Wad and adds it to this one at a specific index.
    default WadEntry
    addMarker(String entryName)
    Adds an entry marker to the Wad (entry with 0 size, arbitrary offset).
    default WadEntry
    addMarkerAt(int index, String entryName)
    Adds an entry marker to the Wad (entry with 0 size, arbitrary offset).
    void
    Closes this Wad.
    default boolean
    contains(String entryName)
    Checks if this Wad contains a particular entry, false otherwise.
    default boolean
    contains(String entryName, int index)
    Checks if this Wad contains a particular entry from a starting entry index, false otherwise.
    default boolean
    contains(String entryName, String startEntryName)
    Checks if this Wad contains a particular entry from a starting entry (by name), false otherwise.
    deleteEntry(int index)
    Deletes a Wad's entry and its contents.
    void
    fetchContent(int offset, int length, byte[] out, int outOffset)
    Fetches a series of bytes from an arbitrary place in the Wad and puts them into a provided array.
    default int
    fetchData(int n, byte[] out, int offset)
    Retrieves the data of a particular entry index and puts it in a provided array and puts it in a provided array.
    default int
    fetchData(String entryName, byte[] out, int offset)
    Retrieves the data of the first occurrence of a particular entry and puts it in a provided array.
    default int
    fetchData(String entryName, int start, byte[] out, int offset)
    Retrieves the data of the first occurrence of a particular entry from a starting index and puts it in a provided array.
    default int
    fetchData(String entryName, String startEntryName, byte[] out, int offset)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) and puts it in a provided array.
    default int
    fetchData(WadEntry entry, byte[] out, int offset)
    Fetches the data of the specified entry and puts it in a provided array.
    default WadEntry[]
    Returns all WadEntry objects (in a new array).
    default WadEntry[]
    getAllEntries(String entryName)
    Returns all WadEntry objects named entryName.
    default int[]
    Gets the indices of all WadEntry objects named entryName.
    default byte[]
    getContent(int offset, int length)
    Gets a series of bytes representing the data at an arbitrary place in the Wad.
    int
     
    default byte[]
    getData(int n)
    Retrieves the data of a particular entry index.
    default byte[]
    getData(String entryName)
    Retrieves the data of the first occurrence of a particular entry.
    default byte[]
    getData(String entryName, int start)
    Retrieves the data of the first occurrence of a particular entry from a starting index.
    default byte[]
    getData(String entryName, String startEntryName)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name).
    default byte[]
    Retrieves the data of the specified entry.
    default <BO extends BinaryObject>
    BO
    getDataAs(int n, Class<BO> type)
    Retrieves the data of an entry at a particular index as a deserialized lump.
    default <BO extends BinaryObject>
    BO[]
    getDataAs(int n, Class<BO> type, int objectLength)
    Retrieves the data of an entry at a particular index as a deserialized lump of multiple objects.
    default <BO extends BinaryObject>
    BO
    getDataAs(String entryName, int start, Class<BO> type)
    Retrieves the data of the first occurrence of a particular entry from a starting index as a deserialized lump.
    default <BO extends BinaryObject>
    BO[]
    getDataAs(String entryName, int start, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry from a starting index as a deserialized lump of multiple objects.
    default <BO extends BinaryObject>
    BO
    getDataAs(String entryName, Class<BO> type)
    Retrieves the data of the first occurrence of a particular entry as a deserialized lump.
    default <BO extends BinaryObject>
    BO[]
    getDataAs(String entryName, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry as a deserialized lump of multiple objects.
    default <BO extends BinaryObject>
    BO
    getDataAs(String entryName, String startEntryName, Class<BO> type)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as a deserialized lump.
    default <BO extends BinaryObject>
    BO[]
    getDataAs(String entryName, String startEntryName, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as a deserialized lump of multiple objects.
    default <BO extends BinaryObject>
    BO
    getDataAs(WadEntry entry, Class<BO> type)
    Retrieves the data of the specified entry as a deserialized lump.
    default <BO extends BinaryObject>
    BO[]
    getDataAs(WadEntry entry, Class<BO> type, int objectLength)
    Retrieves the data of the specified entry as a deserialized lump of multiple objects.
    default <BO extends BinaryObject>
    List<BO>
    getDataAsList(int n, Class<BO> type, int objectLength)
    Retrieves the data of an entry at a particular index as a deserialized lump of multiple objects.
    default <BO extends BinaryObject>
    List<BO>
    getDataAsList(String entryName, int start, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry from a starting index as a deserialized lump of multiple objects.
    default <BO extends BinaryObject>
    List<BO>
    getDataAsList(String entryName, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry as a deserialized lump of multiple objects.
    default <BO extends BinaryObject>
    List<BO>
    getDataAsList(String entryName, String startEntryName, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as a deserialized lump of multiple objects.
    default <BO extends BinaryObject>
    List<BO>
    getDataAsList(WadEntry entry, Class<BO> type, int objectLength)
    Retrieves the data of the specified entry as a deserialized lump of multiple objects.
    getEntry(int n)
    Gets the WadEntry at index n.
    default WadEntry
    getEntry(String entryName)
    Gets the first WadEntry named entryName.
    default WadEntry
    getEntry(String entryName, int start)
    Z Gets the first WadEntry named entryName, starting from a particular index.
    default WadEntry
    getEntry(String entryName, String startEntryName)
    Gets the first WadEntry named entryName, starting from a particular entry's index.
    int
     
    getInlineScanner(int n, Class<BO> type, int objectLength)
    Retrieves the data of a particular entry at a specific index and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.
    getInlineScanner(String entryName, int start, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry from a starting index and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.
    getInlineScanner(String entryName, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.
    getInlineScanner(String entryName, String startEntryName, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.
    getInlineScanner(WadEntry entry, Class<BO> type, int objectLength)
    Retrieves the data of the specified entry and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.
    default InputStream
    Retrieves the data of a particular entry index and returns it as a stream.
    default InputStream
    Retrieves the data of the first occurrence of a particular entry and returns it as a stream.
    default InputStream
    getInputStream(String entryName, int start)
    Retrieves the data of the first occurrence of a particular entry from a starting index and returns it as a stream.
    default InputStream
    getInputStream(String entryName, String startEntryName)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) and returns it as a stream.
    default InputStream
    Retrieves the data of the specified entry from a starting index and returns it as a stream.
    default WadEntry
    getLastEntry(String entryName)
    Gets the last WadEntry named entryName.
    default WadEntry
    getNthEntry(String entryName, int n)
    Gets the n-th WadEntry named entryName.
    default Reader
    getReader(int n, Charset charset)
    Retrieves a Reader for an entry at a particular index as a decoded stream of characters.
    default Reader
    getReader(String entryName, int start, Charset charset)
    Retrieves a Reader for the first occurrence of a particular entry from a starting index as a decoded stream of characters.
    default Reader
    getReader(String entryName, String startEntryName, Charset charset)
    Retrieves a Reader for the first occurrence of a particular entry from a starting entry (by name) as a decoded stream of characters.
    default Reader
    getReader(String entryName, Charset charset)
    Retrieves a Reader for the first occurrence of a particular entry as a decoded stream of characters.
    default Reader
    getReader(WadEntry entry, Charset charset)
    Retrieves a Reader for the specified entry as a decoded stream of characters.
    default <BO extends BinaryObject>
    BinaryObject.Scanner<BO>
    getScanner(int n, Class<BO> type, int objectLength)
    Retrieves the data of a particular entry at a specific index and returns it as a deserializing scanner iterator that returns independent instances of objects.
    default <BO extends BinaryObject>
    BinaryObject.Scanner<BO>
    getScanner(String entryName, int start, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry from a starting index and returns it as a deserializing scanner iterator that returns independent instances of objects.
    default <BO extends BinaryObject>
    BinaryObject.Scanner<BO>
    getScanner(String entryName, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry and returns it as a deserializing scanner iterator that returns independent instances of objects.
    default <BO extends BinaryObject>
    BinaryObject.Scanner<BO>
    getScanner(String entryName, String startEntryName, Class<BO> type, int objectLength)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) and returns it as a deserializing scanner iterator that returns independent instances of objects.
    default <BO extends BinaryObject>
    BinaryObject.Scanner<BO>
    getScanner(WadEntry entry, Class<BO> type, int objectLength)
    Retrieves the data of the specified entry and returns it as a deserializing scanner iterator that returns independent instances of objects.
    default String
    getTextData(int n, Charset charset)
    Retrieves the data of an entry at a particular index as a decoded string of characters.
    default String
    getTextData(String entryName, int start, Charset charset)
    Retrieves the data of the first occurrence of a particular entry from a starting index as a decoded string of characters.
    default String
    getTextData(String entryName, String startEntryName, Charset charset)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as a decoded string of characters.
    default String
    getTextData(String entryName, Charset charset)
    Retrieves the data of the first occurrence of a particular entry as a decoded string of characters.
    default String
    getTextData(WadEntry entry, Charset charset)
    Retrieves the data of the specified entry as a decoded string of characters.
    default <TO extends TextObject>
    TO
    getTextDataAs(int n, Charset charset, Class<TO> type)
    Retrieves the text data of an entry at a particular index as an interpreted text-originating object.
    default <TO extends TextObject>
    TO
    getTextDataAs(String entryName, int start, Charset charset, Class<TO> type)
    Retrieves the data of the first occurrence of a particular entry from a starting index as an interpreted text-originating object.
    default <TO extends TextObject>
    TO
    getTextDataAs(String entryName, String startEntryName, Charset charset, Class<TO> type)
    Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as an interpreted text-originating object.
    default <TO extends TextObject>
    TO
    getTextDataAs(String entryName, Charset charset, Class<TO> type)
    Retrieves the data of the first occurrence of a particular entry as an interpreted text-originating object.
    default <TO extends TextObject>
    TO
    getTextDataAs(WadEntry entry, Charset charset, Class<TO> type)
    Retrieves the data of the specified entry as an interpreted text-originating object.
    default int
    indexOf(String entryName)
    Gets the first index of an entry of name entryName.
    default int
    indexOf(String entryName, int start)
    Gets the first index of an entry of name "entryName" from a starting point.
    default int
    indexOf(String entryName, String startEntryName)
    Gets the first index of an entry of name "entryName" from a starting point entry "startEntryName".
    boolean
    Checks if this WAD is an Internal WAD.
    boolean
    Checks if this WAD is a Patch WAD.
    static boolean
    isWAD(File file)
    Checks if a file is a valid WAD file.
    default int
    lastIndexOf(String entryName)
    Gets the last index of an entry of name entryName.
    default WadEntry[]
    mapEntries(int startIndex, int maxLength)
    Retrieves a contiguous set of entries from this Wad, starting from a desired index.
    removeEntry(int index)
    Remove a Wad's entry (but not contents).
    void
    renameEntry(int index, String newName)
    Renames the entry at an index in the Wad.
    void
    replaceEntry(int index, byte[] data)
    Replaces the entry at an index in the Wad.
    default <BO extends BinaryObject>
    void
    replaceEntry(int index, BO data)
    Replaces the entry at an index in the Wad.
    default <BO extends BinaryObject>
    void
    replaceEntry(int index, BO[] data)
    Replaces the entry at an index in the Wad.
    default <TO extends TextObject>
    void
    replaceEntry(int index, TO data, Charset encoding)
    Replaces the entry at an index in the Wad.
    void
    setEntries(WadEntry... entryList)
    Completely replaces the list of entries in this Wad with a completely different set of entries.
    default void
    setEntry(int index, WadEntry entry)
    Replaces an entry in the Wad - no content, just descriptor.
    default <BO extends BinaryObject>
    void
    transformData(int n, Class<BO> type, int objectLength, BinaryObject.Transformer<BO> transformer)
    Retrieves the data of a particular entry index as a deserialized lump of multiple objects, optionally transforms it, then writes it back to the Wad.
    default <BO extends BinaryObject>
    void
    transformData(int n, Class<BO> type, BinaryObject.Transformer<BO> transformer)
    Retrieves the deserialized data of a particular entry index, optionally transforms it, then writes it back to the Wad.
    default <BO extends BinaryObject>
    boolean
    transformData(String entryName, int start, Class<BO> type, int objectLength, BinaryObject.Transformer<BO> transformer)
    Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
    default <BO extends BinaryObject>
    boolean
    transformData(String entryName, int start, Class<BO> type, BinaryObject.Transformer<BO> transformer)
    Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
    default <BO extends BinaryObject>
    boolean
    transformData(String entryName, Class<BO> type, int objectLength, BinaryObject.Transformer<BO> transformer)
    Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
    default <BO extends BinaryObject>
    boolean
    transformData(String entryName, Class<BO> type, BinaryObject.Transformer<BO> transformer)
    Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
    default <BO extends BinaryObject>
    boolean
    transformData(String entryName, String startEntryName, Class<BO> type, int objectLength, BinaryObject.Transformer<BO> transformer)
    Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
    default <BO extends BinaryObject>
    boolean
    transformData(String entryName, String startEntryName, Class<BO> type, BinaryObject.Transformer<BO> transformer)
    Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
    default <TO extends TextObject>
    void
    transformTextData(int n, Charset charset, Class<TO> type, TextObject.Transformer<TO> transformer)
    Retrieves the decoded data of a particular entry index, optionally transforms it, then writes it back to the Wad.
    default <TO extends TextObject>
    boolean
    transformTextData(String entryName, int start, Charset charset, Class<TO> type, TextObject.Transformer<TO> transformer)
    Retrieves the decoded data of a particular entry, optionally transforms it, then writes it back to the Wad.
    default <TO extends TextObject>
    boolean
    transformTextData(String entryName, String startEntryName, Charset charset, Class<TO> type, TextObject.Transformer<TO> transformer)
    Retrieves the decoded data of a particular entry, optionally transforms it, then writes it back to the Wad.
    default <TO extends TextObject>
    boolean
    transformTextData(String entryName, Charset charset, Class<TO> type, TextObject.Transformer<TO> transformer)
    Retrieves the decoded data of a particular entry, optionally transforms it, then writes it back to the Wad.
    void
    unmapEntries(int startIndex, WadEntry... entryList)
    Replaces a series of WadEntry objects in this Wad, using the provided list of entries as the replacement list.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Field Details

    • NO_ENTRIES

      static final WadEntry[] NO_ENTRIES
    • NO_DATA

      static final byte[] NO_DATA
  • Method Details

    • isWAD

      static boolean isWAD(File file) throws IOException
      Checks if a file is a valid WAD file. This opens the provided file for reading only, inspects the first four bytes for a valid header, and then closes it.
      Parameters:
      file - the file to inspect.
      Returns:
      true if the file exists, is a file, and is a WAD file, or false otherwise.
      Throws:
      IOException - if the file cannot be read.
      SecurityException - if you don't have permission to read the file.
      Since:
      2.3.0
    • isIWAD

      boolean isIWAD()
      Checks if this WAD is an Internal WAD.
      Returns:
      true if so, false if not.
    • isPWAD

      boolean isPWAD()
      Checks if this WAD is a Patch WAD.
      Returns:
      true if so, false if not.
    • getEntryCount

      int getEntryCount()
      Returns:
      the number of entries in this Wad.
    • getContentLength

      int getContentLength()
      Returns:
      the amount of content data in this Wad in bytes.
    • getEntry

      WadEntry getEntry(int n)
      Gets the WadEntry at index n.
      Parameters:
      n - the index of the entry in the entry list.
      Returns:
      the entry at n.
      Throws:
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
    • getEntry

      default WadEntry getEntry(String entryName)
      Gets the first WadEntry named entryName.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry.
      Returns:
      the first entry named entryName or null if not found.
    • getEntry

      default WadEntry getEntry(String entryName, int start)
      Z Gets the first WadEntry named entryName, starting from a particular index.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry.
      start - the index with which to start the search (a value less than 0 is considered 0).
      Returns:
      the first entry named entryName or null if not found.
    • getEntry

      default WadEntry getEntry(String entryName, String startEntryName)
      Gets the first WadEntry named entryName, starting from a particular entry's index. If startEntryName is not found, the search returns null.

      The names are case-insensitive.

      Parameters:
      entryName - the name of the entry.
      startEntryName - the name of the starting entry to find (first occurrence).
      Returns:
      the first entry named entryName or null if entryName or startEntryName not found.
      Throws:
      NullPointerException - if entryName or startEntryName is null.
    • getNthEntry

      default WadEntry getNthEntry(String entryName, int n)
      Gets the n-th WadEntry named entryName.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry.
      n - the n-th occurrence to find, 0-based (0 is first, 1 is second, and so on).
      Returns:
      the n-th entry named entryName or null if not found.
    • getLastEntry

      default WadEntry getLastEntry(String entryName)
      Gets the last WadEntry named entryName.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry.
      Returns:
      the last entry named entryName or null if not found.
    • getAllEntries

      default WadEntry[] getAllEntries()
      Returns all WadEntry objects (in a new array).
      Returns:
      an array of all of the WadEntry objects.
    • getAllEntries

      default WadEntry[] getAllEntries(String entryName)
      Returns all WadEntry objects named entryName.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry.
      Returns:
      an array of all of the WadEntry objects with the name entryName.
    • getAllEntryIndices

      default int[] getAllEntryIndices(String entryName)
      Gets the indices of all WadEntry objects named entryName.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry.
      Returns:
      an array of all of the WadEntry objects with the name entryName.
    • indexOf

      default int indexOf(String entryName)
      Gets the first index of an entry of name entryName.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      Returns:
      the index of the entry in this file, or -1 if not found.
    • indexOf

      default int indexOf(String entryName, int start)
      Gets the first index of an entry of name "entryName" from a starting point.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search (a value less than 0 is considered 0).
      Returns:
      the index of the entry in this file, or -1 if not found.
      Throws:
      ArrayIndexOutOfBoundsException - if start < 0 or >= size.
    • indexOf

      default int indexOf(String entryName, String startEntryName)
      Gets the first index of an entry of name "entryName" from a starting point entry "startEntryName". If startEntryName is not found, the search returns null.

      The names are case-insensitive.

      Parameters:
      entryName - the name of the entry.
      startEntryName - the name of the starting entry to find (first occurrence).
      Returns:
      the index of the entry named entryName in this file, or -1 if entryName or startEntryName not found.
    • lastIndexOf

      default int lastIndexOf(String entryName)
      Gets the last index of an entry of name entryName.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      Returns:
      the index of the entry in this file, or -1 if not found.
    • fetchContent

      void fetchContent(int offset, int length, byte[] out, int outOffset) throws IOException
      Fetches a series of bytes from an arbitrary place in the Wad and puts them into a provided array. This is will attempt to get the full provided length, throwing an exception if it does not.
      Parameters:
      offset - the offset byte into that data to start at.
      length - the amount of bytes to fetch.
      out - the destination array of bytes.
      outOffset - the offset into the destination array to put the bytes into.
      Throws:
      IndexOutOfBoundsException - if offset plus length will go past the end of the destination array.
      IOException - if an error occurs during read.
      NullPointerException - if out is null.
      Since:
      2.4.0
    • fetchData

      default int fetchData(int n, byte[] out, int offset) throws IOException
      Retrieves the data of a particular entry index and puts it in a provided array and puts it in a provided array.
      Parameters:
      n - the index of the entry in the Wad.
      out - the output array of bytes.
      offset - the offset into the array to to put the read bytes.
      Returns:
      the amount of bytes read.
      Throws:
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      IndexOutOfBoundsException - if offset plus length will go past the end of the content area.
      IOException - if an error occurs during read.
      NullPointerException - if out is null.
      Since:
      2.4.0
    • fetchData

      default int fetchData(String entryName, byte[] out, int offset) throws IOException
      Retrieves the data of the first occurrence of a particular entry and puts it in a provided array.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      out - the output array of bytes.
      offset - the offset into the array to to put the read bytes.
      Returns:
      the amount of bytes read, or -1 if the entry could not be found.
      Throws:
      IndexOutOfBoundsException - if offset plus length will go past the end of the content area.
      IOException - if an error occurs during read.
      NullPointerException - if out is null.
      Since:
      2.4.0
    • fetchData

      default int fetchData(String entryName, int start, byte[] out, int offset) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index and puts it in a provided array.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      out - the output array of bytes.
      offset - the offset into the array to to put the read bytes.
      Returns:
      the amount of bytes read, or -1 if the entry could not be found.
      Throws:
      IndexOutOfBoundsException - if offset plus length will go past the end of the content area.
      IOException - if an error occurs during read.
      NullPointerException - if out is null.
      Since:
      2.4.0
    • fetchData

      default int fetchData(String entryName, String startEntryName, byte[] out, int offset) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) and puts it in a provided array.

      The names are case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      out - the output array of bytes.
      offset - the offset into the array to to put the read bytes.
      Returns:
      the amount of bytes read, or -1 if the entry could not be found.
      Throws:
      IndexOutOfBoundsException - if offset plus length will go past the end of the content area.
      IOException - if an error occurs during read.
      NullPointerException - if out is null.
      Since:
      2.4.0
    • fetchData

      default int fetchData(WadEntry entry, byte[] out, int offset) throws IOException
      Fetches the data of the specified entry and puts it in a provided array.
      Parameters:
      entry - the entry to use.
      out - the output array of bytes.
      offset - the offset into the array to to put the read bytes.
      Returns:
      the amount of bytes read.
      Throws:
      IndexOutOfBoundsException - if offset plus length will go past the end of the content area.
      IOException - if an error occurs during read.
      NullPointerException - if out is null.
      Since:
      2.4.0
    • getInputStream

      default InputStream getInputStream(int n) throws IOException
      Retrieves the data of a particular entry index and returns it as a stream.
      Parameters:
      n - the index of the entry in the file.
      Returns:
      an open input stream of the data, or null if it can't be retrieved.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
    • getInputStream

      default InputStream getInputStream(String entryName) throws IOException
      Retrieves the data of the first occurrence of a particular entry and returns it as a stream.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      Returns:
      an open input stream of the data, or null if it can't be retrieved.
      Throws:
      IOException - if the data couldn't be retrieved.
      NullPointerException - if entryName is null.
    • getInputStream

      default InputStream getInputStream(String entryName, int start) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index and returns it as a stream.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      Returns:
      an open input stream of the data, or null if it can't be retrieved.
      Throws:
      IOException - if the data couldn't be retrieved.
      NullPointerException - if entryName is null.
      ArrayIndexOutOfBoundsException - if start < 0 or >= size.
    • getInputStream

      default InputStream getInputStream(String entryName, String startEntryName) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) and returns it as a stream.

      The names are case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry with which to start the search.
      Returns:
      an open input stream of the data, or null if it can't be retrieved.
      Throws:
      IOException - if the data couldn't be retrieved.
      NullPointerException - if entryName is null.
      ArrayIndexOutOfBoundsException - if start < 0 or >= size.
    • getInputStream

      default InputStream getInputStream(WadEntry entry) throws IOException
      Retrieves the data of the specified entry from a starting index and returns it as a stream.
      Parameters:
      entry - the entry to use.
      Returns:
      an open input stream of the data.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
    • getReader

      default Reader getReader(int n, Charset charset) throws IOException
      Retrieves a Reader for an entry at a particular index as a decoded stream of characters.
      Parameters:
      n - the index of the entry in the Wad.
      charset - the source charset encoding.
      Returns:
      a Reader for reading the character stream.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      See Also:
    • getReader

      default Reader getReader(String entryName, Charset charset) throws IOException
      Retrieves a Reader for the first occurrence of a particular entry as a decoded stream of characters.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      charset - the source charset encoding.
      Returns:
      a Reader for reading the character stream, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getReader

      default Reader getReader(String entryName, int start, Charset charset) throws IOException
      Retrieves a Reader for the first occurrence of a particular entry from a starting index as a decoded stream of characters.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      start - the starting index to search from.
      charset - the source charset encoding.
      Returns:
      a Reader for reading the character stream, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getReader

      default Reader getReader(String entryName, String startEntryName, Charset charset) throws IOException
      Retrieves a Reader for the first occurrence of a particular entry from a starting entry (by name) as a decoded stream of characters.

      The names are case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      charset - the source charset encoding.
      Returns:
      a Reader for reading the character stream, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getReader

      default Reader getReader(WadEntry entry, Charset charset) throws IOException
      Retrieves a Reader for the specified entry as a decoded stream of characters.
      Parameters:
      entry - the entry to use.
      charset - the source charset encoding.
      Returns:
      a Reader for reading the character stream.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
      See Also:
    • getContent

      default byte[] getContent(int offset, int length) throws IOException
      Gets a series of bytes representing the data at an arbitrary place in the Wad.
      Parameters:
      offset - the offset byte into that data to start at.
      length - the amount of bytes to return.
      Returns:
      a copy of the byte data as an array of bytes.
      Throws:
      IndexOutOfBoundsException - if offset plus length will go past the end of the content area.
      IOException - if an error occurs during read.
      Since:
      2.2.0
    • getData

      default byte[] getData(int n) throws IOException
      Retrieves the data of a particular entry index.
      Parameters:
      n - the index of the entry in the Wad.
      Returns:
      a byte array of the data.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
    • getData

      default byte[] getData(String entryName) throws IOException
      Retrieves the data of the first occurrence of a particular entry.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      Returns:
      a byte array of the data, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved.
    • getData

      default byte[] getData(String entryName, int start) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      Returns:
      a byte array of the data, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved.
      NullPointerException - if entryName is null.
      ArrayIndexOutOfBoundsException - if start < 0 or >= size.
    • getData

      default byte[] getData(String entryName, String startEntryName) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name).

      The names are case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      Returns:
      a byte array of the data, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved.
      NullPointerException - if entryName or startEntryName is null.
    • getData

      default byte[] getData(WadEntry entry) throws IOException
      Retrieves the data of the specified entry.
      Parameters:
      entry - the entry to use.
      Returns:
      a byte array of the data.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
    • getTextData

      default String getTextData(int n, Charset charset) throws IOException
      Retrieves the data of an entry at a particular index as a decoded string of characters.
      Parameters:
      n - the index of the entry in the Wad.
      charset - the source charset encoding.
      Returns:
      the data, decoded.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      See Also:
    • getTextData

      default String getTextData(String entryName, Charset charset) throws IOException
      Retrieves the data of the first occurrence of a particular entry as a decoded string of characters.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      charset - the source charset encoding.
      Returns:
      the data, decoded, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getTextData

      default String getTextData(String entryName, int start, Charset charset) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index as a decoded string of characters.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      start - the starting index to search from.
      charset - the source charset encoding.
      Returns:
      the data, decoded, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getTextData

      default String getTextData(String entryName, String startEntryName, Charset charset) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as a decoded string of characters.

      The names are case-insensitive.

      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      charset - the source charset encoding.
      Returns:
      the data, decoded, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getTextData

      default String getTextData(WadEntry entry, Charset charset) throws IOException
      Retrieves the data of the specified entry as a decoded string of characters.
      Parameters:
      entry - the entry to use.
      charset - the source charset encoding.
      Returns:
      the data, decoded.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
      See Also:
    • getTextDataAs

      default <TO extends TextObject> TO getTextDataAs(int n, Charset charset, Class<TO> type) throws IOException
      Retrieves the text data of an entry at a particular index as an interpreted text-originating object.
      Type Parameters:
      TO - the result type.
      Parameters:
      n - the index of the entry in the Wad.
      charset - the source charset encoding.
      type - the object type to convert the text data to.
      Returns:
      the data, decoded.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      See Also:
    • getTextDataAs

      default <TO extends TextObject> TO getTextDataAs(String entryName, Charset charset, Class<TO> type) throws IOException
      Retrieves the data of the first occurrence of a particular entry as an interpreted text-originating object.

      The name is case-insensitive.

      Type Parameters:
      TO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      charset - the source charset encoding.
      type - the object type to convert the text data to.
      Returns:
      the data, decoded, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getTextDataAs

      default <TO extends TextObject> TO getTextDataAs(String entryName, int start, Charset charset, Class<TO> type) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index as an interpreted text-originating object.

      The name is case-insensitive.

      Type Parameters:
      TO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      start - the starting index to search from.
      charset - the source charset encoding.
      type - the object type to convert the text data to.
      Returns:
      the data, decoded, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getTextDataAs

      default <TO extends TextObject> TO getTextDataAs(String entryName, String startEntryName, Charset charset, Class<TO> type) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as an interpreted text-originating object.

      The names are case-insensitive.

      Type Parameters:
      TO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      charset - the source charset encoding.
      type - the object type to convert the text data to.
      Returns:
      the data, decoded, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getTextDataAs

      default <TO extends TextObject> TO getTextDataAs(WadEntry entry, Charset charset, Class<TO> type) throws IOException
      Retrieves the data of the specified entry as an interpreted text-originating object.
      Type Parameters:
      TO - the result type.
      Parameters:
      entry - the entry to use.
      charset - the source charset encoding.
      type - the type to decode to.
      Returns:
      the data, decoded.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO getDataAs(int n, Class<BO> type) throws IOException
      Retrieves the data of an entry at a particular index as a deserialized lump.

      Note that if the lump ordinarily as multiple amounts of the object type in question, this will read only the first one.

      Type Parameters:
      BO - the result type.
      Parameters:
      n - the index of the entry in the Wad.
      type - the class type to deserialize into.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO getDataAs(String entryName, Class<BO> type) throws IOException
      Retrieves the data of the first occurrence of a particular entry as a deserialized lump.

      The name is case-insensitive.

      Note that if the lump ordinarily as multiple amounts of the object type in question, this will read only the first one.

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      type - the class type to deserialize into.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO getDataAs(String entryName, int start, Class<BO> type) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index as a deserialized lump.

      The name is case-insensitive.

      Note that if the lump ordinarily as multiple amounts of the object type in question, this will read only the first one.

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      type - the class type to deserialize into.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO getDataAs(String entryName, String startEntryName, Class<BO> type) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as a deserialized lump.

      The names are case-insensitive.

      Note that if the lump ordinarily as multiple amounts of the object type in question, this will read only the first one.

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      type - the class type to deserialize into.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO getDataAs(WadEntry entry, Class<BO> type) throws IOException
      Retrieves the data of the specified entry as a deserialized lump.

      Note that if the lump ordinarily as multiple amounts of the object type in question, this will read only the first one.

      Type Parameters:
      BO - the result type.
      Parameters:
      entry - the entry to use.
      type - the class type to deserialize into.
      Returns:
      the data, deserialized.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO[] getDataAs(int n, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of an entry at a particular index as a deserialized lump of multiple objects.
      Type Parameters:
      BO - the result type.
      Parameters:
      n - the index of the entry in the Wad.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO[] getDataAs(String entryName, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry as a deserialized lump of multiple objects.

      The name is case-insensitive.

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO[] getDataAs(String entryName, int start, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index as a deserialized lump of multiple objects.

      The name is case-insensitive.

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO[] getDataAs(String entryName, String startEntryName, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as a deserialized lump of multiple objects.

      The names are case-insensitive.

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getDataAs

      default <BO extends BinaryObject> BO[] getDataAs(WadEntry entry, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the specified entry as a deserialized lump of multiple objects.
      Type Parameters:
      BO - the result type.
      Parameters:
      entry - the entry to use.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
      See Also:
    • getDataAsList

      default <BO extends BinaryObject> List<BO> getDataAsList(int n, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of an entry at a particular index as a deserialized lump of multiple objects.
      Type Parameters:
      BO - the result type.
      Parameters:
      n - the index of the entry in the Wad.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      See Also:
    • getDataAsList

      default <BO extends BinaryObject> List<BO> getDataAsList(String entryName, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry as a deserialized lump of multiple objects.

      The name is case-insensitive.

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getDataAsList

      default <BO extends BinaryObject> List<BO> getDataAsList(String entryName, int start, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index as a deserialized lump of multiple objects.

      The name is case-insensitive.

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getDataAsList

      default <BO extends BinaryObject> List<BO> getDataAsList(String entryName, String startEntryName, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) as a deserialized lump of multiple objects.

      The names are case-insensitive.

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized, or null if the entry doesn't exist.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entryName is null.
      See Also:
    • getDataAsList

      default <BO extends BinaryObject> List<BO> getDataAsList(WadEntry entry, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the specified entry as a deserialized lump of multiple objects.
      Type Parameters:
      BO - the result type.
      Parameters:
      entry - the entry to use.
      type - the class type to deserialize into.
      objectLength - the length of each individual object in bytes.
      Returns:
      the data, deserialized.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
      See Also:
    • getScanner

      default <BO extends BinaryObject> BinaryObject.Scanner<BO> getScanner(int n, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of a particular entry at a specific index and returns it as a deserializing scanner iterator that returns independent instances of objects.

      Use of this to iterate through objects may be preferable when all of them in a lump do not need to be scanned or deserialized.

      If you don't intend to read the entirety of the entry via the BinaryObject.InlineScanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      n - the index of the entry.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
    • getScanner

      default <BO extends BinaryObject> BinaryObject.Scanner<BO> getScanner(String entryName, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry and returns it as a deserializing scanner iterator that returns independent instances of objects.

      Use of this to iterate through objects may be preferable when all of them in a lump do not need to be scanned or deserialized.

      The name is case-insensitive.

      If you don't intend to read the entirety of the entry via the BinaryObject.Scanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data, or null if the entry can't be found.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
    • getScanner

      default <BO extends BinaryObject> BinaryObject.Scanner<BO> getScanner(String entryName, int start, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index and returns it as a deserializing scanner iterator that returns independent instances of objects.

      Use of this to iterate through objects may be preferable when all of them in a lump do not need to be scanned or deserialized.

      The name is case-insensitive.

      If you don't intend to read the entirety of the entry via the BinaryObject.Scanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data, or null if the entry can't be found.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
    • getScanner

      default <BO extends BinaryObject> BinaryObject.Scanner<BO> getScanner(String entryName, String startEntryName, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) and returns it as a deserializing scanner iterator that returns independent instances of objects.

      Use of this to iterate through objects may be preferable when all of them in a lump do not need to be scanned or deserialized.

      The names are case-insensitive.

      If you don't intend to read the entirety of the entry via the BinaryObject.Scanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data, or null if the entry can't be found.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
    • getScanner

      default <BO extends BinaryObject> BinaryObject.Scanner<BO> getScanner(WadEntry entry, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the specified entry and returns it as a deserializing scanner iterator that returns independent instances of objects.

      Use of this to iterate through objects may be preferable when all of them in a lump do not need to be scanned or deserialized.

      If you don't intend to read the entirety of the entry via the BinaryObject.Scanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      entry - the entry to use.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
    • getInlineScanner

      default <BO extends BinaryObject> BinaryObject.InlineScanner<BO> getInlineScanner(int n, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of a particular entry at a specific index and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.

      This is useful for when you would want to quickly scan through a set of serialized objects while ensuring low memory use. Do NOT store the references returned by next() anywhere as the contents of that reference will be changed by the next call to next().

      If you don't intend to read the entirety of the entry via the BinaryObject.InlineScanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      n - the index of the entry.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
    • getInlineScanner

      default <BO extends BinaryObject> BinaryObject.InlineScanner<BO> getInlineScanner(String entryName, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.

      This is useful for when you would want to quickly scan through a set of serialized objects while ensuring low memory use. Do NOT store the references returned by next() anywhere as the contents of that reference will be changed by the next call to next().

      The name is case-insensitive.

      If you don't intend to read the entirety of the entry via the BinaryObject.InlineScanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data, or null if the entry can't be found.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
    • getInlineScanner

      default <BO extends BinaryObject> BinaryObject.InlineScanner<BO> getInlineScanner(String entryName, int start, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting index and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.

      This is useful for when you would want to quickly scan through a set of serialized objects while ensuring low memory use. Do NOT store the references returned by next() anywhere as the contents of that reference will be changed by the next call to next().

      The name is case-insensitive.

      If you don't intend to read the entirety of the entry via the BinaryObject.InlineScanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data, or null if the entry can't be found.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
    • getInlineScanner

      default <BO extends BinaryObject> BinaryObject.InlineScanner<BO> getInlineScanner(String entryName, String startEntryName, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the first occurrence of a particular entry from a starting entry (by name) and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.

      This is useful for when you would want to quickly scan through a set of serialized objects while ensuring low memory use. Do NOT store the references returned by next() anywhere as the contents of that reference will be changed by the next call to next().

      The names are case-insensitive.

      If you don't intend to read the entirety of the entry via the BinaryObject.InlineScanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data, or null if the entry can't be found.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
    • getInlineScanner

      default <BO extends BinaryObject> BinaryObject.InlineScanner<BO> getInlineScanner(WadEntry entry, Class<BO> type, int objectLength) throws IOException
      Retrieves the data of the specified entry and returns it as a deserializing scanner iterator that returns the same object instance with its contents changed.

      This is useful for when you would want to quickly scan through a set of serialized objects while ensuring low memory use. Do NOT store the references returned by next() anywhere as the contents of that reference will be changed by the next call to next().

      If you don't intend to read the entirety of the entry via the BinaryObject.InlineScanner, close it after you finish (or use a try-with-resources block)!

      Type Parameters:
      BO - the result type.
      Parameters:
      entry - the entry to use.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      Returns:
      a scanner for the data.
      Throws:
      IOException - if the data couldn't be retrieved or the entry's offsets breach the file extents.
      NullPointerException - if entry is null.
    • transformData

      default <BO extends BinaryObject> void transformData(int n, Class<BO> type, BinaryObject.Transformer<BO> transformer) throws IOException
      Retrieves the deserialized data of a particular entry index, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      BO - the data type.
      Parameters:
      n - the index of the entry in the Wad.
      type - the class type to deserialize into.
      transformer - the transformer function to use - called on each object read.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformData

      default <BO extends BinaryObject> boolean transformData(String entryName, Class<BO> type, BinaryObject.Transformer<BO> transformer) throws IOException
      Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      BO - the data type.
      Parameters:
      entryName - the name of the entry to find.
      type - the class type to deserialize into.
      transformer - the transformer function to use - called on each object read.
      Returns:
      true if the entry was found and the transformer function was called at least once, false otherwise.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformData

      default <BO extends BinaryObject> boolean transformData(String entryName, int start, Class<BO> type, BinaryObject.Transformer<BO> transformer) throws IOException
      Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      BO - the data type.
      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      type - the class type to deserialize into.
      transformer - the transformer function to use - called on each object read.
      Returns:
      true if the entry was found and the transformer function was called at least once, false otherwise.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformData

      default <BO extends BinaryObject> boolean transformData(String entryName, String startEntryName, Class<BO> type, BinaryObject.Transformer<BO> transformer) throws IOException
      Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      BO - the data type.
      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      type - the class type to deserialize into.
      transformer - the transformer function to use - called on each object read.
      Returns:
      true if the entry was found and the transformer function was called at least once, false otherwise.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformData

      default <BO extends BinaryObject> void transformData(int n, Class<BO> type, int objectLength, BinaryObject.Transformer<BO> transformer) throws IOException
      Retrieves the data of a particular entry index as a deserialized lump of multiple objects, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      BO - the data type.
      Parameters:
      n - the index of the entry in the Wad.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      transformer - the transformer function to use - called on each object read.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformData

      default <BO extends BinaryObject> boolean transformData(String entryName, Class<BO> type, int objectLength, BinaryObject.Transformer<BO> transformer) throws IOException
      Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      BO - the data type.
      Parameters:
      entryName - the name of the entry to find.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      transformer - the transformer function to use - called on each object read.
      Returns:
      true if the entry was found and the transformer function was called at least once, false otherwise.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformData

      default <BO extends BinaryObject> boolean transformData(String entryName, int start, Class<BO> type, int objectLength, BinaryObject.Transformer<BO> transformer) throws IOException
      Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      BO - the data type.
      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      transformer - the transformer function to use - called on each object read.
      Returns:
      true if the entry was found and the transformer, false
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformData

      default <BO extends BinaryObject> boolean transformData(String entryName, String startEntryName, Class<BO> type, int objectLength, BinaryObject.Transformer<BO> transformer) throws IOException
      Retrieves the deserialized data of a particular entry, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      BO - the data type.
      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      type - the class type to deserialize into.
      objectLength - the length of each object in the entry in bytes.
      transformer - the transformer function to use - called on each object read.
      Returns:
      true if the entry was found and the transformer, false
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformTextData

      default <TO extends TextObject> void transformTextData(int n, Charset charset, Class<TO> type, TextObject.Transformer<TO> transformer) throws IOException
      Retrieves the decoded data of a particular entry index, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      TO - the data type.
      Parameters:
      n - the index of the entry in the Wad.
      charset - the source charset encoding.
      type - the class type to deserialize into.
      transformer - the transformer function to use - called on each object read.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformTextData

      default <TO extends TextObject> boolean transformTextData(String entryName, Charset charset, Class<TO> type, TextObject.Transformer<TO> transformer) throws IOException
      Retrieves the decoded data of a particular entry, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      TO - the data type.
      Parameters:
      entryName - the name of the entry to find.
      charset - the source charset encoding.
      type - the class type to deserialize into.
      transformer - the transformer function to use - called on each object read.
      Returns:
      true if the entry was found and the transformer function was called at least once, false otherwise.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformTextData

      default <TO extends TextObject> boolean transformTextData(String entryName, int start, Charset charset, Class<TO> type, TextObject.Transformer<TO> transformer) throws IOException
      Retrieves the decoded data of a particular entry, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      TO - the data type.
      Parameters:
      entryName - the name of the entry to find.
      start - the index with which to start the search.
      charset - the source charset encoding.
      type - the class type to deserialize into.
      transformer - the transformer function to use - called on each object read.
      Returns:
      true if the entry was found and the transformer function was called at least once, false otherwise.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • transformTextData

      default <TO extends TextObject> boolean transformTextData(String entryName, String startEntryName, Charset charset, Class<TO> type, TextObject.Transformer<TO> transformer) throws IOException
      Retrieves the decoded data of a particular entry, optionally transforms it, then writes it back to the Wad.
      Type Parameters:
      TO - the data type.
      Parameters:
      entryName - the name of the entry to find.
      startEntryName - the starting entry (by name) with which to start the search.
      charset - the source charset encoding.
      type - the class type to deserialize into.
      transformer - the transformer function to use - called on each object read.
      Returns:
      true if the entry was found and the transformer function was called at least once, false otherwise.
      Throws:
      IOException - if the data couldn't be retrieved.
      ArrayIndexOutOfBoundsException - if n < 0 or >= size.
      Since:
      2.1.0
    • contains

      default boolean contains(String entryName)
      Checks if this Wad contains a particular entry, false otherwise.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry.
      Returns:
      true if so, false if not.
    • contains

      default boolean contains(String entryName, int index)
      Checks if this Wad contains a particular entry from a starting entry index, false otherwise.

      The name is case-insensitive.

      Parameters:
      entryName - the name of the entry.
      index - the index to start from.
      Returns:
      true if so, false if not.
    • contains

      default boolean contains(String entryName, String startEntryName)
      Checks if this Wad contains a particular entry from a starting entry (by name), false otherwise.

      The names are case-insensitive.

      Parameters:
      entryName - the name of the entry.
      startEntryName - the starting entry (by name).
      Returns:
      true if so, false if not.
    • addEntry

      default WadEntry addEntry(String entryName, int offset, int length) throws IOException
      Adds a new entry to the Wad, but with an explicit offset and size. Exercise caution with this method, since you can reference anywhere in the Wad!
      Parameters:
      entryName - the name of the entry.
      offset - the entry's content start byte.
      length - the entry's length in bytes.
      Returns:
      the entry that was created.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name, or the offset/size is negative.
      IOException - if the entry cannot be written.
      NullPointerException - if name is null.
    • addEntry

      default WadEntry addEntry(WadEntry entry) throws IOException
      Adds a new entry to the Wad. Exercise caution with this method, as this entry is added as-is, and an entry can reference anywhere in the Wad!
      Parameters:
      entry - the entry to add.
      Returns:
      the entry added.
      Throws:
      IOException - if the entry cannot be written.
      NullPointerException - if entry is null.
      Since:
      2.9.0
    • addEntryAt

      default WadEntry addEntryAt(int index, String entryName, int offset, int length) throws IOException
      Adds a new entry to the Wad at a specific index, but with an explicit offset and size. The rest of the entries afterward are shifted an index forward. Exercise caution with this method, since you can reference anywhere in the Wad!
      Parameters:
      index - the index at which to add the entry.
      entryName - the name of the entry.
      offset - the entry's content start byte.
      length - the entry's length in bytes.
      Returns:
      the entry that was created.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name, or the offset/size is negative.
      IOException - if the entry cannot be written.
      NullPointerException - if name is null.
      Since:
      2.7.0
    • addEntryAt

      WadEntry addEntryAt(int index, WadEntry entry) throws IOException
      Adds a new entry to the Wad. Exercise caution with this method, as this entry is added as-is, and an entry can reference anywhere in the Wad!
      Parameters:
      index - the index at which to add the entry.
      entry - the entry to add.
      Returns:
      the entry added.
      Throws:
      IOException - if the entry cannot be written.
      NullPointerException - if entry is null.
      Since:
      2.9.0
    • addMarker

      default WadEntry addMarker(String entryName) throws IOException
      Adds an entry marker to the Wad (entry with 0 size, arbitrary offset).
      Parameters:
      entryName - the name of the entry.
      Returns:
      the entry that was added.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IOException - if the entry cannot be written.
      NullPointerException - if name is null.
    • addMarkerAt

      default WadEntry addMarkerAt(int index, String entryName) throws IOException
      Adds an entry marker to the Wad (entry with 0 size, arbitrary offset).
      Parameters:
      index - the index at which to add the marker.
      entryName - the name of the entry.
      Returns:
      the entry that was added.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IOException - if the entry cannot be written.
      NullPointerException - if name is null.
    • addData

      default WadEntry addData(String entryName, byte[] data) throws IOException
      Adds data to this Wad, using entryName as the name of the new entry. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Parameters:
      entryName - the name of the entry to add this as.
      data - the bytes of data to add as this wad's data.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IOException - if the data cannot be written.
      NullPointerException - if entryName or data is null.
    • addData

      default <BO extends BinaryObject> WadEntry addData(String entryName, BO data) throws IOException
      Adds data to this Wad, using entryName as the name of the new entry. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Type Parameters:
      BO - a BinaryObject type.
      Parameters:
      entryName - the name of the entry to add this as.
      data - the BinaryObject to add as this wad's data (converted via BinaryObject.toBytes()).
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IOException - if the data cannot be written.
      NullPointerException - if entryName or data is null.
      Since:
      2.2.0
    • addData

      default <BO extends BinaryObject> WadEntry addData(String entryName, BO[] data) throws IOException
      Adds data to this Wad, using entryName as the name of the new entry. The BinaryObjects provided have all of their converted data concatenated together as one blob of contiguous data. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Type Parameters:
      BO - a BinaryObject type.
      Parameters:
      entryName - the name of the entry to add this as.
      data - the BinaryObjects to add as this wad's data (converted via BinaryObject.toBytes()).
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IOException - if the data cannot be written.
      NullPointerException - if entryName or data is null.
      Since:
      2.2.0
    • addData

      default <TO extends TextObject> WadEntry addData(String entryName, TO data, Charset encoding) throws IOException
      Adds data to this Wad, using entryName as the name of the new entry. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Type Parameters:
      TO - a TextObject type.
      Parameters:
      entryName - the name of the entry to add this as.
      data - the TextObject to add as this wad's data (converted via TextObject.toText(), then String.getBytes(Charset)).
      encoding - the encoding type for the data written to the Wad.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IOException - if the data cannot be written.
      NullPointerException - if entryName or data or encoding is null.
      Since:
      2.2.0
    • addData

      default WadEntry addData(String entryName, File fileToAdd) throws IOException
      Adds data to this Wad, using entryName as the name of the new entry. The provided File is read until the end of the file is reached. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Parameters:
      entryName - the name of the entry to add this as.
      fileToAdd - the file to add the contents of.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      FileNotFoundException - if the file path refers to a file that is a directory or doesn't exist.
      IOException - if the data cannot be written or the stream could not be read.
      NullPointerException - if entryName or fileToAdd is null.
      Since:
      2.7.0
    • addData

      default WadEntry addData(String entryName, InputStream in) throws IOException
      Adds data to this Wad, using entryName as the name of the new entry. The provided input stream is read until the end of the stream is reached. The input stream is NOT CLOSED, afterward. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Parameters:
      entryName - the name of the entry to add this as.
      in - the input stream to read.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IOException - if the data cannot be written or the stream could not be read.
      NullPointerException - if entryName or in is null.
      Since:
      2.7.0
    • addData

      default WadEntry addData(String entryName, InputStream in, int maxLength) throws IOException
      Adds data to this Wad, using entryName as the name of the new entry. The provided input stream is read until the end of the stream is reached or maxLength bytes are read. The input stream is NOT CLOSED, afterward. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Parameters:
      entryName - the name of the entry to add this as.
      in - the input stream to read.
      maxLength - the maximum amount of bytes to read from the InputStream, or a value < 0 to keep reading until end-of-stream.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IOException - if the data cannot be written or the stream could not be read.
      NullPointerException - if entryName or in is null.
      Since:
      2.7.0
    • addDataAt

      default WadEntry addDataAt(int index, String entryName, byte[] data) throws IOException
      Adds data to this Wad at a particular entry offset, using entryName as the name of the entry. The rest of the entries in the wad are shifted down one index. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Parameters:
      index - the index at which to add the entry.
      entryName - the name of the entry to add this as.
      data - the bytes of data to add as this wad's data.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IndexOutOfBoundsException - if the provided index < 0 or > getEntryCount().
      IOException - if the data cannot be written.
      NullPointerException - if entryName or data is null.
    • addDataAt

      default <BO extends BinaryObject> WadEntry addDataAt(int index, String entryName, BO data) throws IOException
      Adds data to this Wad at a particular entry offset, using entryName as the name of the entry. The rest of the entries in the wad are shifted down one index. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Type Parameters:
      BO - a BinaryObject type.
      Parameters:
      index - the index at which to add the entry.
      entryName - the name of the entry to add this as.
      data - the BinaryObject to add as this wad's data (converted via BinaryObject.toBytes()).
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IndexOutOfBoundsException - if the provided index < 0 or > getEntryCount().
      IOException - if the data cannot be written.
      NullPointerException - if entryName or data is null.
      Since:
      2.2.0
    • addDataAt

      default <BO extends BinaryObject> WadEntry addDataAt(int index, String entryName, BO[] data) throws IOException
      Adds data to this Wad at a particular entry offset, using entryName as the name of the entry. The rest of the entries in the wad are shifted down one index. The BinaryObjects provided have all of their converted data concatenated together as one blob of contiguous data. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Type Parameters:
      BO - a BinaryObject type.
      Parameters:
      index - the index at which to add the entry.
      entryName - the name of the entry to add this as.
      data - the BinaryObjects to add as this wad's data (converted via BinaryObject.toBytes()).
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IndexOutOfBoundsException - if the provided index < 0 or > getEntryCount().
      IOException - if the data cannot be written.
      NullPointerException - if entryName or data is null.
      Since:
      2.2.0
    • addDataAt

      default <TO extends TextObject> WadEntry addDataAt(int index, String entryName, TO data, Charset encoding) throws IOException
      Adds data to this Wad at a particular entry offset, using entryName as the name of the entry. The rest of the entries in the wad are shifted down one index. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Type Parameters:
      TO - a TextObject type.
      Parameters:
      index - the index at which to add the entry.
      entryName - the name of the entry to add this as.
      data - the TextObject to add as this wad's data (converted via TextObject.toText(), then String.getBytes(Charset)).
      encoding - the encoding type for the data written to the Wad.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IndexOutOfBoundsException - if the provided index < 0 or > getEntryCount().
      IOException - if the data cannot be written.
      NullPointerException - if entryName or data is null.
      Since:
      2.2.0
    • addDataAt

      default WadEntry addDataAt(int index, String entryName, File fileToAdd) throws IOException
      Adds data to this Wad, using entryName as the name of the new entry. The provided File is read until the end of the file is reached. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Parameters:
      index - the index at which to add the entry.
      entryName - the name of the entry to add this as.
      fileToAdd - the file to add the contents of.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      FileNotFoundException - if the file path refers to a file that is a directory or doesn't exist.
      IOException - if the data cannot be written or the stream could not be read.
      NullPointerException - if entryName or fileToAdd is null.
      Since:
      2.7.0
    • addDataAt

      default WadEntry addDataAt(int index, String entryName, InputStream in) throws IOException
      Adds data to this Wad at a particular entry offset, using entryName as the name of the entry. The provided input stream is read until the end of the stream is reached. The input stream is NOT CLOSED, afterward. The rest of the entries in the wad are shifted down one index. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Parameters:
      index - the index at which to add the entry.
      entryName - the name of the entry to add this as.
      in - the input stream to read.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IndexOutOfBoundsException - if the provided index < 0 or > getEntryCount().
      IOException - if the data cannot be written or the stream could not be read.
      NullPointerException - if entryName or in is null.
      Since:
      2.7.0
    • addDataAt

      WadEntry addDataAt(int index, String entryName, InputStream in, int maxLength) throws IOException
      Adds data to this Wad at a particular entry offset, using entryName as the name of the entry. The provided input stream is read until the end of the stream is reached or maxLength bytes are read. The input stream is NOT CLOSED, afterward. The rest of the entries in the wad are shifted down one index. The overhead for multiple individual additions may be expensive I/O-wise depending on the Wad implementation.
      Parameters:
      index - the index at which to add the entry.
      entryName - the name of the entry to add this as.
      in - the input stream to read.
      maxLength - the maximum amount of bytes to read from the InputStream, or a value < 0 to keep reading until end-of-stream.
      Returns:
      a WadEntry that describes the added data.
      Throws:
      IllegalArgumentException - if the provided name is not a valid name.
      IndexOutOfBoundsException - if the provided index < 0 or > getEntryCount().
      IOException - if the data cannot be written or the stream could not be read.
      NullPointerException - if entryName or in is null.
      Since:
      2.7.0
    • addFrom

      default void addFrom(Wad source, int startIndex, int maxLength) throws IOException
      Takes entries and their data from another Wad and adds it to this one.
      Parameters:
      source - the the source Wad.
      startIndex - the starting entry index.
      maxLength - the maximum amount of entries from the starting index to copy.
      Throws:
      IOException - if an error occurs on read from the source Wad or write to this Wad.
      Since:
      2.5.0
    • addFrom

      default void addFrom(Wad source, WadEntry... entries) throws IOException
      Takes entries and their data from another Wad and adds it to this one.
      Parameters:
      source - the the source Wad.
      entries - the entries to copy over.
      Throws:
      IOException - if an error occurs on read from the source Wad or write to this Wad.
      Since:
      2.5.0
    • addFromAt

      default void addFromAt(int destIndex, Wad source, int startIndex, int maxLength) throws IOException
      Takes entries and their data from another Wad and adds it to this one at a specific index.
      Parameters:
      destIndex - the index at which to add the entries.
      source - the the source Wad.
      startIndex - the starting entry index.
      maxLength - the maximum amount of entries from the starting index to copy.
      Throws:
      IndexOutOfBoundsException - if the provided index < 0 or > getEntryCount().
      IOException - if an error occurs on read from the source Wad or write to this Wad.
      Since:
      2.5.0
    • addFromAt

      default void addFromAt(int destIndex, Wad source, WadEntry... entries) throws IOException
      Takes entries and their data from another Wad and adds it to this one at a specific index.
      Parameters:
      destIndex - the index at which to add the entries.
      source - the the source Wad.
      entries - the entries to copy over.
      Throws:
      IndexOutOfBoundsException - if the provided index < 0 or > getEntryCount().
      IOException - if an error occurs on read from the source Wad or write to this Wad.
      Since:
      2.5.0
    • replaceEntry

      void replaceEntry(int index, byte[] data) throws IOException
      Replaces the entry at an index in the Wad. If the incoming data is the same size as the entry at the index, this will change the data in-place without deleting and adding.
      Parameters:
      index - the index of the entry to replace.
      data - the data to replace the entry with.
      Throws:
      IndexOutOfBoundsException - if index < 0 or >= size.
      IOException - if the entry cannot be replaced.
      NullPointerException - if data is null.
    • replaceEntry

      default <BO extends BinaryObject> void replaceEntry(int index, BO data) throws IOException
      Replaces the entry at an index in the Wad. If the incoming data is the same size as the entry at the index, this will change the data in-place without deleting and adding.
      Type Parameters:
      BO - the BinaryObject type.
      Parameters:
      index - the index of the entry to replace.
      data - the data to replace the entry with.
      Throws:
      IndexOutOfBoundsException - if index < 0 or >= size.
      IOException - if the entry cannot be replaced.
      NullPointerException - if data is null.
      Since:
      2.4.0
    • replaceEntry

      default <BO extends BinaryObject> void replaceEntry(int index, BO[] data) throws IOException
      Replaces the entry at an index in the Wad. If the incoming data is the same size as the entry at the index, this will change the data in-place without deleting and adding.
      Type Parameters:
      BO - the BinaryObject type.
      Parameters:
      index - the index of the entry to replace.
      data - the BinaryObjects to replace as this wad's data (converted via BinaryObject.toBytes()).
      Throws:
      IndexOutOfBoundsException - if index < 0 or >= size.
      IOException - if the entry cannot be replaced.
      NullPointerException - if data is null.
      Since:
      2.4.0
    • replaceEntry

      default <TO extends TextObject> void replaceEntry(int index, TO data, Charset encoding) throws IOException
      Replaces the entry at an index in the Wad. If the incoming data is the same size as the entry at the index, this will change the data in-place without deleting and adding.
      Type Parameters:
      TO - a TextObject type.
      Parameters:
      index - the index of the entry to replace.
      data - the TextObject to add as this Wad's data (converted via TextObject.toText(), then String.getBytes(Charset)).
      encoding - the encoding type for the data written to the Wad.
      Throws:
      IndexOutOfBoundsException - if index < 0 or >= size.
      IOException - if the entry cannot be replaced.
      NullPointerException - if data is null.
      Since:
      2.4.0
    • renameEntry

      void renameEntry(int index, String newName) throws IOException
      Renames the entry at an index in the Wad.
      Parameters:
      index - the index of the entry to rename.
      newName - the new name of the entry.
      Throws:
      IndexOutOfBoundsException - if index < 0 or >= size.
      IOException - if the entry cannot be renamed.
    • removeEntry

      WadEntry removeEntry(int index) throws IOException
      Remove a Wad's entry (but not contents). This will leave abandoned, un-addressed data in a Wad file and will not be removed until the data is purged.
      Parameters:
      index - the index of the entry to delete.
      Returns:
      the entry removed from the Wad.
      Throws:
      IndexOutOfBoundsException - if index < 0 or >= size.
      IOException - if the entry cannot be removed.
    • deleteEntry

      WadEntry deleteEntry(int index) throws IOException
      Deletes a Wad's entry and its contents. The overhead for multiple deletions may be expensive I/O-wise.
      Parameters:
      index - the index of the entry to delete.
      Returns:
      the entry deleted.
      Throws:
      IndexOutOfBoundsException - if index < 0 or >= size.
      IOException - if the entry cannot be deleted.
    • setEntry

      default void setEntry(int index, WadEntry entry) throws IOException
      Replaces an entry in the Wad - no content, just descriptor. Exercise caution with this method, as this entry is added as-is, and an entry can reference anywhere in the Wad!

      This is equivalent to: unmapEntries(index, entry).

      Parameters:
      index - the index of the entry to change.
      entry - the entry to set.
      Throws:
      IndexOutOfBoundsException - if index < 0 or >= size.
      IOException - if the file cannot be altered in such a manner.
      Since:
      2.9.0
      See Also:
    • mapEntries

      default WadEntry[] mapEntries(int startIndex, int maxLength)
      Retrieves a contiguous set of entries from this Wad, starting from a desired index. If the amount of entries desired goes outside the Wad's potential set of entries, this will retrieve up to those entries (for example, mapEntries(5, 10) in an 8-entry Wad will only return 3 entries: 5, 6, and 7).
      Parameters:
      startIndex - the starting index to map from (inclusive).
      maxLength - the amount of entries to retrieve from the index position.
      Returns:
      an array of references to WadEntry objects.
      Throws:
      IllegalArgumentException - if startIndex is less than 0.
    • unmapEntries

      void unmapEntries(int startIndex, WadEntry... entryList) throws IOException
      Replaces a series of WadEntry objects in this Wad, using the provided list of entries as the replacement list. If the list of entries plus the starting index would breach the original list of entries, the excess is appended to the Wad.
      Parameters:
      startIndex - the starting index to replace from (inclusive).
      entryList - the set of entries to replace (in order) from the starting index.
      Throws:
      IOException - if the entries could not be written.
      IllegalArgumentException - if startIndex is less than 0.
    • setEntries

      void setEntries(WadEntry... entryList) throws IOException
      Completely replaces the list of entries in this Wad with a completely different set of entries.
      Parameters:
      entryList - the set of entries that will make up this Wad.
      Throws:
      IOException - if the entries could not be written.
      IllegalArgumentException - if startIndex is less than 0.
    • close

      void close() throws IOException
      Closes this Wad. Does nothing on some implementations.
      Throws:
      IOException - if an error occurred during close.