Revision 20374 trunk/libraries/libjni-mrsid/src/main/java/es/gva/cit/jmrsid/MrSIDImageReader.java
MrSIDImageReader.java | ||
---|---|---|
62 | 62 |
*/ |
63 | 63 |
|
64 | 64 |
protected void finalize(){ |
65 |
this.close(); |
|
65 |
if (cPtr != 0) |
|
66 |
this.close(); |
|
66 | 67 |
} |
67 | 68 |
|
68 | 69 |
/** |
... | ... | |
70 | 71 |
* |
71 | 72 |
*/ |
72 | 73 |
public void close(){ |
73 |
if(cPtr > 0){
|
|
74 |
if(cPtr != 0){
|
|
74 | 75 |
FreeMrSIDImageReaderNat(cPtr); |
75 |
cPtr = -1;
|
|
76 |
cPtr = 0;
|
|
76 | 77 |
} |
77 | 78 |
} |
78 | 79 |
|
... | ... | |
85 | 86 |
|
86 | 87 |
public MrSIDImageReader(String pszFilename)throws MrSIDException, IOException{ |
87 | 88 |
|
89 |
/*if ((pszFilename == null) || (pszFilename.equals(""))) |
|
90 |
throw new MrSIDException("Nombre de fichero incorrecto"); |
|
91 |
|
|
88 | 92 |
File f = new File( pszFilename ); |
89 | 93 |
if(!f.exists()) |
90 | 94 |
throw new IOException("The file "+pszFilename+" don't exists"); |
91 | 95 |
|
92 | 96 |
if(!f.canRead()) |
93 |
throw new IOException("I can't read the file"); |
|
97 |
throw new IOException("I can't read the file");*/
|
|
94 | 98 |
|
95 |
cPtr=MrSIDImageReaderArrayNat(pszFilename.getBytes());
|
|
99 |
cPtr = MrSIDImageReaderArrayNat(pszFilename.getBytes());
|
|
96 | 100 |
|
97 |
if(cPtr<0)
|
|
101 |
if(cPtr == 0)
|
|
98 | 102 |
throw new MrSIDException("Error in MrDID Open"); |
99 | 103 |
|
100 | 104 |
} |
Also available in: Unified diff