one.world.data
Class Chunk
java.lang.Object
|
+--one.world.core.Tuple
|
+--one.world.data.Data
|
+--one.world.data.BinaryData
|
+--one.world.data.Chunk
- All Implemented Interfaces:
- Cloneable, Serializable
- public class Chunk
- extends BinaryData
Implementation of a chunk. A chunk holds part of a large, arbitrary
byte array. The entire byte array can be accessed by following the
previous and next symbolic references (which form
a doubly-linked list). The name and type of each chunk in the list
of chunks must be the same. The data array of each chunk may be of
any size, including 0 (making it possible to store the head of a
list of chunks after all chunks have been stored and the total
length is actually known). However, by convention, the data for
every chunk in the list of chunks should be of size Constants.CHUNKING_THRESHOLD, with exception of the last
chunk, which holds the rest of the data and therefore may be
smaller than the CHUNKING_THRESHOLD.
- Version:
- $Revision: 1.2 $
- See Also:
- Serialized Form
|
Field Summary |
long |
length
The total length of the binary data in the list of chunks. |
Guid |
next
The next chunk or null if this chunk is the last
chunk in the list of chunks. |
Guid |
previous
The previous chunk or null if this chunk is the
first chunk in the list of chunks. |
|
Constructor Summary |
Chunk()
Create a new, empty chunk. |
Chunk(Guid id,
String name,
String type,
byte[] data,
Guid previous,
Guid next,
long length)
Create a new chunk. |
Chunk(String name,
String type,
byte[] data,
Guid previous,
Guid next,
long length)
Create a new chunk. |
|
Method Summary |
String |
toString()
Return a string representation for this chunk. |
| Methods inherited from class one.world.core.Tuple |
clone, containsNonSymbolicHandler, equals, fields, get, getMetaData, getType, hasField, hashCode, hasMetaData, remove, set, setMetaData, wrap |
previous
public Guid previous
- The previous chunk or
null if this chunk is the
first chunk in the list of chunks.
next
public Guid next
- The next chunk or
null if this chunk is the last
chunk in the list of chunks.
length
public long length
- The total length of the binary data in the list of chunks. This
field may be -1 if this chunk is not the first chunk in the list
of chunks.
Chunk
public Chunk()
- Create a new, empty chunk.
Chunk
public Chunk(String name,
String type,
byte[] data,
Guid previous,
Guid next,
long length)
- Create a new chunk.
- Parameters:
name - The name for the new chunk.type - The MIME type for the new chunk.data - The data for the new chunk, which is
not copied.previous - The ID of the previous chunk in the list of
chunks.next - The ID of the next chunk in the list of chunks.
Chunk
public Chunk(Guid id,
String name,
String type,
byte[] data,
Guid previous,
Guid next,
long length)
- Create a new chunk.
- Parameters:
id - The ID for the new chunk.name - The name for the new chunk.type - The MIME type for the new chunk.data - The data for the new chunk, which is
not copied.previous - The ID of the previous chunk in the list of
chunks.next - The ID of the next chunk in the list of chunks.
toString
public String toString()
- Return a string representation for this chunk.
- Overrides:
toString in class BinaryData
- Following copied from class:
one.world.core.Tuple
- Returns:
- A string representation for this tuple.
(C) Copyright 2001 UW CSE