package com.ximple.io.dgn7;
|
|
//~--- JDK imports ------------------------------------------------------------
|
|
import java.io.IOException;
|
import java.nio.ByteBuffer;
|
import java.nio.ByteOrder;
|
|
import com.vividsolutions.jts.util.Assert;
|
|
/**
|
* Dgn7fileHeader
|
*
|
* @author Ulysses
|
* @version 0.1
|
* @since 2006/5/17 下午 01:21:00
|
*/
|
public class Dgn7fileHeader
|
{
|
private short elmtype;
|
private byte[] raw;
|
|
public Dgn7fileHeader()
|
{
|
}
|
|
public void read(ByteBuffer file, boolean strict) throws IOException
|
{
|
file.order(ByteOrder.LITTLE_ENDIAN);
|
elmtype = file.getShort();
|
|
short wtf = file.getShort();
|
int length = (wtf * 2);
|
|
if (file.remaining() != (length))
|
{
|
Assert.shouldNeverReachHere();
|
}
|
|
raw = new byte[length];
|
file.get(raw, 0, file.remaining());
|
}
|
|
public String toString()
|
{
|
return "Dgn7fileHeader{" + "raw=" + ((raw == null) ? "null" : raw.length) + '}';
|
}
|
|
public int size()
|
{
|
if (raw == null)
|
{
|
return 0;
|
}
|
|
return raw.length + 4;
|
}
|
}
|