All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class blackmane.quake2.pak.Quake2PakWriter

java.lang.Object
   |
   +----blackmane.quake2.pak.Quake2PakWriter

public class Quake2PakWriter
extends Object

Variable Index

 o directory
 o header

Constructor Index

 o Quake2PakWriter(String, String[], String[])
This creates the header and directory structures, but doesn't actually write out the file yet - don't know why, just felt like doing it that way.

Method Index

 o create()
Creates the pak file from scratch.
 o NameToQuakeName(String)
Used to convert a String into an array of bytes after converting all instances of \ into /.

Variables

 o header
 protected Quake2PakHeader header
 o directory
 protected Quake2PakDirectoryEntry directory[]

Constructors

 o Quake2PakWriter
 public Quake2PakWriter(String name,
                        String inputFiles[],
                        String internalNames[]) throws IOException
This creates the header and directory structures, but doesn't actually write out the file yet - don't know why, just felt like doing it that way. This will work out the header and the directory array and have the information correct, with the directory set to be written out at the end of the pak file.

Parameters:
name - the name of the pak file to create;
inputFiles - the list of directory+path files that will be put into the pak file;
internalNames - the list of names that the real names will appear as in the pak file
Throws: IOException
if there is a problem opening one of the specified files in inputFiles.

Methods

 o NameToQuakeName
 public static byte[] NameToQuakeName(String name)
Used to convert a String into an array of bytes after converting all instances of \ into /. This is because quake uses / as a separator and java may use a \ (platform decides).

Parameters:
name - the name to convert to quake2 format.
Returns:
an array of bytes (56 bytes in length) that are used for the internal name
 o create
 public void create() throws IOException
Creates the pak file from scratch. This will overwrite any existing file of the same name, and will create any parent directories necessary.

Throws: IOException
if an error occurs accessing a file or reading a file

All Packages  Class Hierarchy  This Package  Previous  Next  Index