Revision 9 trunk/libraries/libCq CMS for java.old/src/org/cresques/io/ShpFile.java
ShpFile.java | ||
---|---|---|
6 | 6 |
|
7 | 7 |
package org.cresques.io; |
8 | 8 |
|
9 |
import java.io.FileInputStream; |
|
9 | 10 |
import java.io.FileNotFoundException; |
10 | 11 |
import java.io.FileReader; |
11 | 12 |
import java.io.IOException; |
12 | 13 |
import java.io.InputStream; |
13 | 14 |
import java.io.InputStreamReader; |
14 | 15 |
import java.io.Reader; |
16 |
import java.nio.MappedByteBuffer; |
|
17 |
import java.nio.channels.FileChannel; |
|
15 | 18 |
|
16 | 19 |
import org.cresques.geo.Projection; |
17 | 20 |
import org.cresques.geo.ReProjection; |
18 | 21 |
import org.cresques.px.gml.*; |
19 | 22 |
|
20 |
import com.iver.coput.ShapeFileHeader; |
|
21 |
|
|
22 | 23 |
/** |
23 | 24 |
* Clase de soporte para ficheros .shp de ArcView |
24 | 25 |
* |
... | ... | |
52 | 53 |
try { |
53 | 54 |
if (FileFolder.isUrl(name)) { |
54 | 55 |
ZipFileFolder zFolder = new ZipFileFolder(name); |
55 |
InputStream is = zFolder.getInputStream(name); |
|
56 |
return load(new InputStreamReader(is)); |
|
56 |
return load(zFolder.getInputStream(name)); |
|
57 | 57 |
} else |
58 |
return load(new FileReader(name));
|
|
58 |
return load(new FileInputStream(name));
|
|
59 | 59 |
} catch (FileNotFoundException e) { |
60 | 60 |
e.printStackTrace(); |
61 | 61 |
} catch (IOException ie) { |
... | ... | |
65 | 65 |
return this; |
66 | 66 |
} |
67 | 67 |
|
68 |
public GeoFile load(Reader fr) { |
|
68 |
public int openLayer() { |
|
69 |
try { |
|
70 |
FileInputStream fin = new FileInputStream(m_Path); |
|
71 |
// Open the file and then get a channel from the stream |
|
72 |
FileChannel fc = fin.getChannel(); |
|
73 |
long sz = fc.size(); |
|
74 |
// Get the file's size and then map it into memory |
|
75 |
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz); |
|
76 |
} |
|
77 |
catch(Exception e) |
|
78 |
{ |
|
79 |
System.err.notify(); |
|
80 |
} |
|
81 |
return 0; |
|
82 |
} |
|
83 |
public GeoFile load(InputStream is) { |
|
69 | 84 |
// create a new header. |
70 |
ShapeFileHeader myHeader = new ShapeFileHeader();
|
|
85 |
ShpFileHeader myHeader = new ShpFileHeader();
|
|
71 | 86 |
|
72 | 87 |
// read the header |
73 | 88 |
myHeader.readHeader(fr); |
Also available in: Unified diff