|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjwadlib.Lump
public class Lump
The Lump class is the parent class of all lump classes that are used
to virtually store lumps from WAD files that have been extracted into a Wad object.
| Field Summary | |
|---|---|
private WadByteBuffer |
content
The WadByteBuffer that contains the content of the
lump. |
protected java.lang.String |
name
The name of the lump as a String. |
| Constructor Summary | |
|---|---|
Lump(java.lang.String name)
Creates a Lump with the specified name, of size 0. |
|
Lump(java.lang.String name,
byte[] data)
Creates a Lump with the specified name and data. |
|
Lump(java.lang.String name,
int size)
Creates a Lump with the specified name and size. |
|
Lump(java.lang.String name,
int size,
java.nio.channels.FileChannel filechannel,
int pointer)
Creates a Lump object from the information in the WAD file's
directory. |
|
Lump(java.lang.String name,
WadByteBuffer data)
Creates a Lump with the specified name and data. |
|
| Method Summary | |
|---|---|
boolean |
alterRawLumpData(byte[] data)
Changes the Lump's data with the specified array of bytes. |
boolean |
alterRawLumpData(WadByteBuffer data)
Changes the Lump's data with the specified WadByteBuffer. |
boolean |
appendRawLumpData(byte[] data)
Append raw byte data to the content of a Lump. |
boolean |
appendRawLumpData(WadByteBuffer data)
Append raw byte data to the content of a Lump. |
void |
changeName(java.lang.String name)
Changes the name of the lump to an eight byte String
that is specified and passed through WadByteBuffer's
convertToEightByteString
method. |
java.lang.String |
getName()
Returns the name of the lump as a String. |
int |
getNumberOfBytes()
Returns the number of bytes in the lump. |
WadByteBuffer |
getRawLumpData()
Sets and returns the actual data of the lump from the WAD file. |
int |
getSize()
Returns the size of the lump, in bytes. |
boolean |
isVirtual()
Returns true if and only if the lump is virtual (has a declared size of zero bytes has a value of null). |
java.lang.String |
toString()
Returns the name of the Lump by calling the getName()
method. |
boolean |
writeToFile(java.io.File directory)
Writes the Lump to a binary file with the Lump's name and
the extension ".lmp". |
boolean |
writeToFile(java.nio.channels.FileChannel filechannel)
Writes the Lump to a binary file. |
boolean |
writeToFile(java.nio.channels.FileChannel filechannel,
long position)
Writes the Lump to a binary file at the specified position. |
boolean |
writeToFile(java.io.File directory,
java.lang.String filename)
Writes the Lump to a binary file with a custom name and the extension
".lmp". |
boolean |
writeToFile(java.io.RandomAccessFile file)
Writes the Lump to a binary file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private WadByteBuffer content
WadByteBuffer that contains the content of the
lump.
protected java.lang.String name
String.
| Constructor Detail |
|---|
public Lump(java.lang.String name)
Lump with the specified name, of size 0.
name - the name of the Lump.
public Lump(java.lang.String name,
int size)
Lump with the specified name and size.
name - the name of the Lump.size - the size of the Lump.
public Lump(java.lang.String name,
byte[] data)
Lump with the specified name and data.
name - the name of the Lump.data - the data contained in the Lump as an array of bytes.
public Lump(java.lang.String name,
WadByteBuffer data)
Lump with the specified name and data.
name - the name of the Lump.data - the data contained in the Lump as a WadByteBuffer.
public Lump(java.lang.String name,
int size,
java.nio.channels.FileChannel filechannel,
int pointer)
throws UnableToReadWADFileException
Lump object from the information in the WAD file's
directory. The actual lump data is not extracted, however the information
needed to extract the data is passed into the object, along with the name
of the lump and the WAD that is found in. The lump itself is actually
extracted from the WAD file when Lump's getRawLumpData() method is called. This is done to save memory and time by
storing only pointers to the data as opposed to the data itself, unless
necessary.
name - the name of lump as a String.size - the size, in bytes, of the lump data.filechannel - the parent Wad's FileChannel.pointer - the starting location in the WAD file of the lump data.
UnableToReadWADFileException - if the WAD file cannot be read.| Method Detail |
|---|
public java.lang.String getName()
String.
String.public boolean isVirtual()
public WadByteBuffer getRawLumpData()
Lump object will store the data
in memory as opposed to retrieving it from the WAD file.
ArrayList.public int getNumberOfBytes()
public int getSize()
Lump's content, but instead how many bytes the WadByteBuffer backing the Lump could hold.
public void changeName(java.lang.String name)
String
that is specified and passed through WadByteBuffer's
convertToEightByteString
method.
name - the new name as a String.public boolean alterRawLumpData(byte[] data)
Lump's data with the specified array of bytes.
data - the new lump data as a byte array.
public boolean alterRawLumpData(WadByteBuffer data)
Lump's data with the specified WadByteBuffer.
data - the new lump data as a WadByteBuffer.
public boolean appendRawLumpData(byte[] data)
Lump.
data - the data to be appended as an array of bytes.
public boolean appendRawLumpData(WadByteBuffer data)
Lump.
data - the data to be appended as a WadByteBuffer.
public boolean writeToFile(java.io.File directory)
throws UnableToWriteLumpFileException
Lump to a binary file with the Lump's name and
the extension ".lmp".
directory - the directory to write the lump file to.
UnableToWriteLumpFileException - if the lump file cannot be written to.
public boolean writeToFile(java.io.File directory,
java.lang.String filename)
throws UnableToWriteLumpFileException
Lump to a binary file with a custom name and the extension
".lmp".
directory - the directory to write the lump file to.filename - the filename of the lump. Do not include an extension, the
extension will be ".lmp".
UnableToWriteLumpFileException - if the lump file cannot be written to.
public boolean writeToFile(java.io.RandomAccessFile file)
throws UnableToWriteLumpFileException
Lump to a binary file.
file - the RandomAccessFile to write to.
UnableToWriteLumpFileException - if the specified file cannot be written to.
public boolean writeToFile(java.nio.channels.FileChannel filechannel)
throws UnableToWriteLumpFileException
Lump to a binary file.
filechannel - the FileChannel to write to.
UnableToWriteLumpFileException - if the specified file cannot be written to.
public boolean writeToFile(java.nio.channels.FileChannel filechannel,
long position)
throws UnableToWriteLumpFileException
Lump to a binary file at the specified position.
filechannel - the FileChannel to write to.position - the position in the FileChannel
to begin writing at.
UnableToWriteLumpFileException - if the specified file cannot be written to.public java.lang.String toString()
Lump by calling the getName()
method. Overrides java.lang.Object's
toString() method.
toString in class java.lang.ObjectLump.
|
jwadlib WAD Library Extending API Version 1.0 Alpha 1 Intended for developers wishing to extend jwadlib, not implement it. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||