Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid
[simgrid.git] / src / bindings / java / org / simgrid / msg / File.java
1 /* Copyright (c) 2012-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 package org.simgrid.msg;
8
9 public class File {
10         /**
11          * Represents the bind between the java comm and the
12          * native C comm. You must never access it, since it is 
13          * automatically set.
14          */
15         private long bind = 0;
16         /**
17          * Constructor, opens the file.
18          * @param path is the file location on the storage 
19          */
20         public File(String path) {
21                 open(path);
22         }
23         protected void finalize() {
24
25         }
26         /**
27          * Opens the file whose name is the string pointed to by path.  
28          * @param path is the file location on the storage
29          */
30         protected native void open(String path);
31         /**
32          * Read elements of a file. 
33          * @param size of each element
34          * @param nMemb is the number of elements of data to write 
35          */
36         public native long read(long size, long nMemb);
37         /**
38          * Write elements into a file. 
39          * @param size of each element  
40          * @param nMemb is the number of elements of data to write 
41          */
42         public native long write(long size, long nMemb);
43         /**
44          * Close the file.      
45          */
46         public native void close();
47         
48         /**
49          * Class initializer, to initialize various JNI stuff
50          */
51         public static native void nativeInit();
52         static {
53                 Msg.nativeInit();
54                 nativeInit();
55         }       
56 }