OSDN Git Service

2003-07-13 Michael Koch <konqueror@gmx.de>
[pf3gnuchains/gcc-fork.git] / libjava / java / nio / MappedByteBufferImpl.java
1 /* MappedByteBufferImpl.java -- 
2    Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
20
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version. */
37
38
39 package java.nio;
40
41 import java.io.IOException;
42 import java.nio.channels.FileChannelImpl;
43 import gnu.gcj.RawData;
44
45 public class MappedByteBufferImpl extends MappedByteBuffer
46 {
47   boolean readOnly;
48   RawData map_address;
49   public FileChannelImpl ch;
50   
51   public MappedByteBufferImpl (FileChannelImpl ch) throws IOException
52   {
53     super ((int) ch.size (), (int) ch.size (), 0, -1);
54     
55     this.ch = ch;
56     map_address = ch.map_address;
57     long si = ch.size () / 1;
58     limit ((int) si);
59   }
60
61   public boolean isReadOnly ()
62   {
63     return readOnly;
64   }
65   
66   public static byte getImpl (FileChannelImpl ch, int index,
67                               int limit, RawData map_address)
68   {
69     throw new Error ("Not implemented");
70   }
71   
72   public static void putImpl (FileChannelImpl ch, int index,
73                               int limit, byte value, RawData map_address)
74   {
75     throw new Error ("Not implemented");
76   }
77
78   public byte get ()
79   {
80     byte result = get (position());
81     position (position() + 1);
82     return result;
83   }
84
85   public ByteBuffer put (byte value)
86   {
87     put (position(), value);
88     position (position() + 1);
89     return this;
90   }
91
92   public byte get (int index)
93   {
94     return getImpl (ch, index, limit (), map_address);
95   }
96
97   public ByteBuffer put (int index, byte value)
98   {
99     putImpl (ch, index, limit (), value, map_address);
100     return this;
101   }
102
103   public ByteBuffer compact ()
104   {
105     throw new Error ("Not implemented");
106   }
107
108   public boolean isDirect ()
109   {
110     return true;
111   }
112
113   public ByteBuffer slice ()
114   {
115     throw new Error ("Not implemented");
116   }
117
118   public ByteBuffer duplicate ()
119   {
120     throw new Error ("Not implemented");
121   }
122
123   public ByteBuffer asReadOnlyBuffer ()
124   {
125     throw new Error ("Not implemented");
126   }
127
128   public CharBuffer asCharBuffer ()
129   {
130     return new CharViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
131   }
132
133   public ShortBuffer asShortBuffer ()
134   {
135     return new ShortViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
136   }
137
138   public IntBuffer asIntBuffer ()
139   {
140     return new IntViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
141   }
142   
143   public LongBuffer asLongBuffer ()
144   {
145     return new LongViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
146   }
147
148   public FloatBuffer asFloatBuffer ()
149   {
150     return new FloatViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
151   }
152
153   public DoubleBuffer asDoubleBuffer ()
154   {
155     return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
156   }
157
158   public char getChar ()
159   {
160     throw new Error ("Not implemented");
161   }
162
163   public char getChar (int index)
164   {
165     throw new Error ("Not implemented");
166   }
167
168   public ByteBuffer putChar (char value)
169   {
170     throw new Error ("Not implemented");
171   }
172
173   public ByteBuffer putChar (int index, char value)
174   {
175     throw new Error ("Not implemented");
176   }
177
178   public double getDouble ()
179   {
180     throw new Error ("Not implemented");
181   }
182
183   public double getDouble (int index)
184   {
185     throw new Error ("Not implemented");
186   }
187
188   public ByteBuffer putDouble (double value)
189   {
190     throw new Error ("Not implemented");
191   }
192
193   public ByteBuffer putDouble (int index, double value)
194   {
195     throw new Error ("Not implemented");
196   }
197
198   public float getFloat ()
199   {
200     throw new Error ("Not implemented");
201   }
202
203   public float getFloat (int index)
204   {
205     throw new Error ("Not implemented");
206   }
207
208   public ByteBuffer putFloat (float value)
209   {
210     throw new Error ("Not implemented");
211   }
212
213   public ByteBuffer putFloat (int index, float value)
214   {
215     throw new Error ("Not implemented");
216   }
217
218   public int getInt ()
219   {
220     throw new Error ("Not implemented");
221   }
222
223   public int getInt (int index)
224   {
225     throw new Error ("Not implemented");
226   }
227
228   public ByteBuffer putInt (int value)
229   {
230     throw new Error ("Not implemented");
231   }
232
233   public ByteBuffer putInt (int index, int value)
234   {
235     throw new Error ("Not implemented");
236   }
237
238   public long getLong ()
239   {
240     throw new Error ("Not implemented");
241   }
242
243   public long getLong (int index)
244   {
245     throw new Error ("Not implemented");
246   }
247
248   public ByteBuffer putLong (long value)
249   {
250     throw new Error ("Not implemented");
251   }
252
253   public ByteBuffer putLong (int index, long value)
254   {
255     throw new Error ("Not implemented");
256   }
257
258   public short getShort ()
259   {
260     throw new Error ("Not implemented");
261   }
262
263   public short getShort (int index)
264   {
265     throw new Error ("Not implemented");
266   }
267
268   public ByteBuffer putShort (short value)
269   {
270     throw new Error ("Not implemented");
271   }
272
273   public ByteBuffer putShort (int index, short value)
274   {
275     throw new Error ("Not implemented");
276   }
277 }