forked from geodmms/xdgnjobs

?? ?
2010-03-31 a911850eb2a5ec8b8ac24c57ce8dcfd2e6800801
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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;
    }
}