svn-gvsig-desktop / branches / Mobile_Compatible_Hito_1 / libFMap_mobile_shp_driver / src-comp / org / gvsig / datasources / impljse / ByteBufferJSE.java @ 21927
History | View | Annotate | Download (1.76 KB)
1 |
package org.gvsig.datasources.impljse; |
---|---|
2 |
|
3 |
import java.nio.ByteBuffer; |
4 |
import java.nio.ByteOrder; |
5 |
|
6 |
import org.gvsig.datasources.common.IByteBuffer; |
7 |
|
8 |
public class ByteBufferJSE implements IByteBuffer { |
9 |
|
10 |
private ByteBuffer buffer = null; |
11 |
|
12 |
public ByteBufferJSE(byte[] bytesCachedRecord) { |
13 |
buffer = ByteBuffer.wrap(bytesCachedRecord);
|
14 |
} |
15 |
|
16 |
public ByteBufferJSE(ByteBuffer bb) { |
17 |
buffer = bb; |
18 |
} |
19 |
|
20 |
public ByteBufferJSE(int l) { |
21 |
buffer = ByteBuffer.allocateDirect(l);
|
22 |
} |
23 |
|
24 |
public ByteBuffer getImplByteBuffer() { |
25 |
return buffer;
|
26 |
} |
27 |
|
28 |
public void position(int fieldOffset) { |
29 |
buffer.position(fieldOffset); |
30 |
} |
31 |
|
32 |
public void get(byte[] data) { |
33 |
buffer.get(data); |
34 |
} |
35 |
|
36 |
public void put(byte[] bytes) { |
37 |
buffer.put(bytes); |
38 |
} |
39 |
|
40 |
public IByteBuffer flip() {
|
41 |
buffer.flip(); |
42 |
return new ByteBufferJSE(buffer); |
43 |
} |
44 |
|
45 |
public void order(ByteOrder ord) { |
46 |
buffer.order(ord); |
47 |
} |
48 |
|
49 |
public void put(byte b) { |
50 |
buffer.put(b); |
51 |
} |
52 |
|
53 |
public void putInt(int v) { |
54 |
buffer.putInt(v); |
55 |
} |
56 |
|
57 |
public void putShort(short s) { |
58 |
buffer.putShort(s); |
59 |
} |
60 |
|
61 |
public int position() { |
62 |
return buffer.position();
|
63 |
} |
64 |
|
65 |
public int remaining() { |
66 |
return buffer.remaining();
|
67 |
} |
68 |
|
69 |
public void rewind() { |
70 |
buffer.rewind(); |
71 |
} |
72 |
|
73 |
public void get(byte[] bb, int p, int l) { |
74 |
|
75 |
buffer.get(bb, p, l); |
76 |
} |
77 |
|
78 |
public ByteOrder order() { |
79 |
return buffer.order();
|
80 |
} |
81 |
|
82 |
public byte get() { |
83 |
return buffer.get();
|
84 |
} |
85 |
|
86 |
public double getDouble(int i) { |
87 |
return buffer.getDouble(i);
|
88 |
} |
89 |
|
90 |
public int capacity() { |
91 |
return buffer.capacity();
|
92 |
} |
93 |
|
94 |
public IByteBuffer limit(int i) { |
95 |
buffer.limit(i); |
96 |
return this; |
97 |
} |
98 |
|
99 |
public void putDouble(double d) { |
100 |
buffer.putDouble(d); |
101 |
} |
102 |
|
103 |
public double getDouble() { |
104 |
return buffer.getDouble();
|
105 |
} |
106 |
|
107 |
public int getInt() { |
108 |
return buffer.getInt();
|
109 |
} |
110 |
|
111 |
public int limit() { |
112 |
return buffer.limit();
|
113 |
} |
114 |
|
115 |
} |