public class Chunk
extends java.lang.Object
ChunkChopper
Every chunk should know how many bytes of data(or
be able figure out) to read before its subchunks are found. Chunks that only have
subchunks need not overrided loadData.
Chunks may store data for later use in loadData with pushData
If a chunk needs to initialize components with from subchunks, that data
can be retrieved with ChunkChopper.popData(java.lang.Object)
inside the initialize(com.microcrowd.loader.java3d.max3ds.ChunkChopper)
method. loadData(com.microcrowd.loader.java3d.max3ds.ChunkChopper)
is called at the beginning of the
loading process, before any data or subchunks have been loaded(the chunk
itself must load its data).
During loadData, if the length of data before subchunks is unknown,
ChunkChopper.getChunkBytes()
may be called and all the data
for the chunk(including subchunks) will be read and returned.
Constructor and Description |
---|
Chunk()
default no-arg constructror.
|
Chunk(java.lang.String chunkName)
default no-arg constructror.
|
Modifier and Type | Method and Description |
---|---|
void |
addSubChunk(java.lang.Integer id,
Chunk subChunk) |
java.lang.String |
getDescription() |
java.lang.String |
getName()
Gets a human readable name for the chunk.
|
Chunk |
getSubChunk(java.lang.Integer id) |
void |
initialize(ChunkChopper chopper)
This method is called after all the current chunks subchunks are
loaded.
|
void |
loadData(ChunkChopper chopper)
This is called by the chunk chopper before any of the chunk's
subchunks are loaded.
|
void |
setDescription(java.lang.String desc) |
void |
setName(java.lang.String name)
Sets nice human readable name for the chunk.
|
java.lang.String |
toString()
Returns the name of this chunk.
|
public Chunk(java.lang.String chunkName)
public Chunk()
public void addSubChunk(java.lang.Integer id, Chunk subChunk)
public Chunk getSubChunk(java.lang.Integer id)
public void initialize(ChunkChopper chopper)
ChunkChopper.popData(java.lang.Object)
The default implementation does nothing.chopper
- may contain data loaded by subchunks.public void loadData(ChunkChopper chopper)
ChunkChopper.popData(java.lang.Object)
The default implementation does nothing.chopper
- may contain data loaded by subchunks.public final void setName(java.lang.String name)
name
- to use for display of this chunk.public final java.lang.String getName()
public final java.lang.String getDescription()
public final void setDescription(java.lang.String desc)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2000-2016 Microcrowd. All Rights Reserved.