return result;
}
-/*
- * Class: org_apache_hadoop_fs_ceph_CephFileSystem
- * Method: ceph_getfilesize
- * Signature: (Ljava/lang/String;)J
- * Returns the file size, or -1 on failure.
- */
-JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getfilesize
- (JNIEnv *env, jobject, jstring j_path)
-{
- dout(10) << "In getfilesize" << dendl;
-
- struct stat stbuf;
-
- jlong result;
-
- const char* c_path = env->GetStringUTFChars(j_path, 0);
- if (c_path == NULL) return -ENOMEM;
- result = ceph_lstat(c_path, &stbuf);
- env->ReleaseStringUTFChars(j_path, c_path);
-
- if (result < 0) return result;
- else result = stbuf.st_size;
-
- return result;
-}
-
/*
* Class: org_apache_hadoop_fs_ceph_CephFileSystem
* Method: ceph_isfile
JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getblocksize
(JNIEnv *, jobject, jstring);
-/*
- * Class: org_apache_hadoop_fs_ceph_CephFileSystem
- * Method: ceph_getfilesize
- * Signature: (Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getfilesize
- (JNIEnv *, jobject, jstring);
-
/*
* Class: org_apache_hadoop_fs_ceph_CephFileSystem
* Method: ceph_isdirectory
private native boolean ceph_rename(String old_path, String new_path);
private native boolean ceph_exists(String path);
private native long ceph_getblocksize(String path);
- private native long ceph_getfilesize(String path);
private native boolean ceph_isdirectory(String path);
private native boolean ceph_isfile(String path);
private native String[] ceph_getdir(String path);
}
}
- private long __getLength(Path path) throws IOException {
- debug("__getLength:enter with path " + path);
- Path abs_path = makeAbsolute(path);
-
- if (!exists(abs_path)) {
- throw new FileNotFoundException("org.apache.hadoop.fs.ceph.CephFileSystem.__getLength: File or directory " + abs_path.toString() + " does not exist.");
- }
-
- long filesize = ceph_getfilesize(abs_path.toString());
- if (filesize < 0) {
- throw new IOException("org.apache.hadoop.fs.ceph.CephFileSystem.getLength: Size of file or directory " + abs_path.toString() + " could not be retrieved.");
- }
- debug("__getLength:exit with size " + filesize);
- return filesize;
- }
-
private Path[] listPaths(Path path) throws IOException {
debug("listPaths:enter with path " + path);
String dirlist[];