FileDocCategorySizeDatePackage
ChunkHeader.javaAPI DocApache Poi 3.0.12697Tue Jun 19 20:35:00 BST 2007org.apache.poi.hdgf.chunks

ChunkHeader

public abstract class ChunkHeader extends Object
A chunk header

Fields Summary
protected int
type
protected int
id
protected int
length
protected int
unknown1
Constructors Summary
Methods Summary
public static org.apache.poi.hdgf.chunks.ChunkHeadercreateChunkHeader(int documentVersion, byte[] data, int offset)
Creates the appropriate ChunkHeader for the Chunk Header at the given location, for the given document version.

		if(documentVersion >= 6) {
			ChunkHeaderV6 ch;
			if(documentVersion > 6) {
				ch = new ChunkHeaderV11();
			} else {
				ch = new ChunkHeaderV6();
			}
			ch.type = (int)LittleEndian.getUInt(data, offset + 0);
			ch.id   = (int)LittleEndian.getUInt(data, offset + 4);
			ch.unknown1 = (int)LittleEndian.getUInt(data, offset + 8);
			ch.length   = (int)LittleEndian.getUInt(data, offset + 12);
			ch.unknown2 = LittleEndian.getShort(data, offset + 16);
			ch.unknown3 = (short)LittleEndian.getUnsignedByte(data, offset + 18);
			return ch;
		} else if(documentVersion == 5) {
			throw new RuntimeException("TODO");
		} else {
			throw new IllegalArgumentException("Visio files with versions below 5 are not supported, yours was " + documentVersion);
		}
	
public intgetId()
Returns the ID/IX of the chunk

		return id;
	
public intgetLength()
Returns the length of the trunk, excluding the length of the header, trailer or separator.

		return length;
	
public abstract intgetSizeInBytes()

public intgetType()
Returns the type of the chunk, which affects the mandatory information

		return type;
	
public intgetUnknown1()

		return unknown1;
	
public abstract booleanhasSeparator()

public abstract booleanhasTrailer()