svn-gvsig-desktop / branches / Mobile_Compatible_Hito_1 / libFMap_mobile_shp_driver / src-comp / org / gvsig / datasources / impljse / RandomAccessFileJSE.java @ 21865
History | View | Annotate | Download (1.12 KB)
1 |
package org.gvsig.datasources.impljse; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.io.FileNotFoundException; |
5 |
import java.io.IOException; |
6 |
import java.io.RandomAccessFile; |
7 |
import java.nio.ByteBuffer; |
8 |
import java.nio.channels.FileChannel; |
9 |
|
10 |
import org.gvsig.datasources.common.IRandomAccessFile; |
11 |
import org.gvsig.datasources.common.IRandomFileChannel; |
12 |
|
13 |
public class RandomAccessFileJSE implements IRandomAccessFile { |
14 |
|
15 |
private RandomAccessFile raf = null; |
16 |
private RandomFileChannelJSE rfc = null; |
17 |
private File file = null; |
18 |
|
19 |
public RandomAccessFileJSE(File f, String mode) throws FileNotFoundException { |
20 |
file = f; |
21 |
raf = new RandomAccessFile(f, mode); |
22 |
} |
23 |
|
24 |
public IRandomFileChannel getChannel() {
|
25 |
|
26 |
FileChannel fc = raf.getChannel();
|
27 |
rfc = new RandomFileChannelJSE(fc);
|
28 |
return rfc;
|
29 |
} |
30 |
|
31 |
public void close() throws IOException { |
32 |
rfc.close(); |
33 |
raf.close(); |
34 |
} |
35 |
|
36 |
// private void printArray(ByteBuffer bb, String tit) {
|
37 |
//
|
38 |
// System.out.println("TITULO: " + tit);
|
39 |
// System.out.println("Primeros:");
|
40 |
// for (int i=0; i<10; i++) {
|
41 |
// System.out.println("Byte: " + i + " : " + bb.get(i));
|
42 |
// }
|
43 |
// System.out.println("FIN: " + tit);
|
44 |
// }
|
45 |
|
46 |
} |