Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
modifiers in right order
[simgrid.git] / src / bindings / java / org / simgrid / msg / File.java
index ed65770..e37b1f4 100644 (file)
@@ -7,6 +7,9 @@
 package org.simgrid.msg;
 
 public class File {
+       public static final int SEEK_SET = 0;
+       public static final int SEEK_CUR = 1;
+       public static final int SEEK_END = 2;
        /**
         * Represents the bind between the java comm and the
         * native C comm. You must never access it, since it is 
@@ -15,12 +18,12 @@ public class File {
        private long bind = 0;
        /**
         * Constructor, opens the file.
-        * @param storage is the name where you can find the file descriptor 
         * @param path is the file location on the storage 
         */
        public File(String path) {
                open(path);
        }
+       @Override
        protected void finalize() {
 
        }
@@ -42,16 +45,21 @@ public class File {
         */
        public native long write(long size, long nMemb);
        /**
-        * Close the file.      
-        */
+        * Write elements into a file. 
+        * @param offset : number of bytes to offset from origin
+        * @param origin : Position used as reference for the offset. It is specified by one of the following constants 
+        *                 defined in <stdio.h> exclusively to be used as arguments for this function (SEEK_SET = 
+        *                 beginning of file, SEEK_CUR = current position of the file pointer, SEEK_END = end of file)
+        */
+       public native void seek(long offset, long origin);
+
+       /** Close the file. */
        public native void close();
-       
-       /**
-        * Class initializer, to initialize various JNI stuff
-        */
+
+       /** Class initializer, to initialize various JNI stuff */
        public static native void nativeInit();
        static {
-               Msg.nativeInit();
+               org.simgrid.NativeLib.nativeInit();
                nativeInit();
        }       
 }
\ No newline at end of file