All Packages Class Hierarchy This Package Previous Next Index
Class blackmane.quake2.pak.Quake2PakReader
java.lang.Object
|
+----blackmane.quake2.pak.Quake2PakReader
- public class Quake2PakReader
- extends Object
-
directory
-
-
file
-
-
header
-
-
open
-
-
valid
-
-
close()
- Closes the file.
-
fileNames()
- Utility function, it returns an array of chopped strings
of the lump names.
-
getDirectory()
-
-
getHeader()
-
-
open()
- Tell whether the pak file is currently open (reads will work), or
closed (reads will not work).
-
read(int)
- Reads a lump from the file and returns a byte array containing the
information.
-
valid()
- Tell whether the pak file has had its header and directory information
read in correctly.
header
protected Quake2PakHeader header
directory
protected Quake2PakDirectoryEntry directory[]
file
protected RandomAccessFile file
open
protected boolean open
valid
protected boolean valid
close
public void close() throws IOException
- Closes the file. Further read() accesses will fail after this has been
called.
read
public byte[] read(int index) throws IOException, Quake2PakException
- Reads a lump from the file and returns a byte array containing the
information.
The passed integer is the directory index to use.
The array being passed back will be set to null if either the
file is not open or the index into the directory was not valid.
- Parameters:
- index - the index of the lump in the directory to fetch.
- Returns:
- an array of bytes containing the lump
- Throws: Quake2PakException
- if the file is not open or not valid
or if the passed index is not in range.
getHeader
public Quake2PakHeader getHeader() throws Quake2PakException
getDirectory
public Quake2PakDirectoryEntry[] getDirectory() throws Quake2PakException
valid
public boolean valid()
- Tell whether the pak file has had its header and directory information
read in correctly.
- Returns:
-
true
if the pak file's header and directory information
have been read in;
false
otherwise.
open
public boolean open()
- Tell whether the pak file is currently open (reads will work), or
closed (reads will not work).
- Returns:
-
true
if the pak file can still perform read()s;
false
otherwise.
fileNames
public String[] fileNames() throws Quake2PakException
- Utility function, it returns an array of chopped strings
of the lump names.
- Returns:
- an array of Strings that contain the internal names from
the lump directory, which have had any 0 bytes at the end removed.
- Throws: Quake2PakException
- is the pak file was not validly opened.
All Packages Class Hierarchy This Package Previous Next Index