| 227 | private native int truncateImpl(long fileDescriptor, long size); |
| 228 | |
| 229 | public long open(byte[] fileName, int mode) throws FileNotFoundException { |
| 230 | if (fileName == null) { |
| 231 | throw new NullPointerException(); |
| 232 | } |
| 233 | long handler = openImpl(fileName, mode); |
| 234 | if (handler < 0) { |
| 235 | try { |
| 236 | throw new FileNotFoundException(new String(fileName, "UTF-8")); |
| 237 | } catch (java.io.UnsupportedEncodingException e) { |
| 238 | // UTF-8 should always be supported, so throw an assertion |
| 239 | FileNotFoundException fnfe = new FileNotFoundException(new String(fileName)); |
| 240 | e.initCause(fnfe); |
| 241 | throw new AssertionError(e); |
| 242 | } |
| 243 | } |
| 244 | return handler; |
| 245 | } |
| 246 | |
| 247 | private native long openImpl(byte[] fileName, int mode); |
| 248 | |