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

Variable Index

 o directory
 o file
 o header
 o open
 o valid

Method Index

 o close()
Closes the file.
 o fileNames()
Utility function, it returns an array of chopped strings of the lump names.
 o getDirectory()
 o getHeader()
 o open()
Tell whether the pak file is currently open (reads will work), or closed (reads will not work).
 o read(int)
Reads a lump from the file and returns a byte array containing the information.
 o valid()
Tell whether the pak file has had its header and directory information read in correctly.

Variables

 o header
 protected Quake2PakHeader header
 o directory
 protected Quake2PakDirectoryEntry directory[]
 o file
 protected RandomAccessFile file
 o open
 protected boolean open
 o valid
 protected boolean valid

Methods

 o close
 public void close() throws IOException
Closes the file. Further read() accesses will fail after this has been called.

 o 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.
 o getHeader
 public Quake2PakHeader getHeader() throws Quake2PakException
 o getDirectory
 public Quake2PakDirectoryEntry[] getDirectory() throws Quake2PakException
 o 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.
 o 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.
 o 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