Class WadEntry
java.lang.Object
net.mtrop.doom.WadEntry
Abstraction of a single entry from a WAD.
This entry contains NO DATA - this is a descriptor for the data in the originating WAD.
- Author:
- Matthew Tropiano
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic WadEntrycreate(byte[] b) Creates a WadEntry.static WadEntryCreates an empty WadEntry with an offset of 12 (beginning of content) and size zero.static WadEntryCreates a WadEntry.getName()byte[]Returns this entry's name as how it is represented in a WAD.intintgetSize()booleanisMarker()Tests if this entry is a "marker" entry.toString()withNewName(String name) Makes a copy of this entry with a new name.withNewOffset(int offset) Makes a copy of this entry with a new offset.withNewSize(int size) Makes a copy of this entry with a new size.
-
Field Details
-
LENGTH
public static final int LENGTHByte length of this object.- See Also:
-
-
Method Details
-
create
Creates an empty WadEntry with an offset of 12 (beginning of content) and size zero. These empty entries are called "marker" entries.- Parameters:
name- the name of the entry.- Returns:
- the constructed WadEntry.
- Throws:
IllegalArgumentException- if the name is invalid or the offset or size is negative.- Since:
- 2.9.0
-
create
Creates a WadEntry.- Parameters:
name- the name of the entry.offset- the offset into the WAD in bytes.size- the size of the entry in bytes.- Returns:
- the constructed WadEntry.
- Throws:
IllegalArgumentException- if the name is invalid or the offset or size is negative.
-
create
Creates a WadEntry.- Parameters:
b- the entry as serialized bytes.- Returns:
- the constructed WadEntry.
- Throws:
IOException- if an entry cannot be read.IllegalArgumentException- if the name is invalid or the offset or size is negative.
-
withNewName
Makes a copy of this entry with a new name.- Parameters:
name- the new name.- Returns:
- the new entry.
- Throws:
IllegalArgumentException- if the name is invalid.- Since:
- 2.1.0
-
withNewOffset
Makes a copy of this entry with a new offset.- Parameters:
offset- the new offset.- Returns:
- the new entry.
- Throws:
IllegalArgumentException- if the offset is negative.- Since:
- 2.1.0
-
withNewSize
Makes a copy of this entry with a new size.- Parameters:
size- the new offset.- Returns:
- the new entry.
- Throws:
IllegalArgumentException- if the size is negative.- Since:
- 2.1.0
-
getName
- Returns:
- the name of the entry.
-
getOffset
public int getOffset()- Returns:
- the offset into the original WAD for the start of the data.
-
getSize
public int getSize()- Returns:
- the size of the entry content in bytes.
-
isMarker
public boolean isMarker()Tests if this entry is a "marker" entry. Marker entries have 0 size.- Returns:
- true if size = 0, false if not.
-
getNameBytes
public byte[] getNameBytes()Returns this entry's name as how it is represented in a WAD.- Returns:
- a byte array of length 8 containing the output data.
-
toString
-