Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add/update copyright notices.
[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         protected String storage;
11         /**
12          * Represents the bind between the java comm and the
13          * native C comm. You must never access it, since it is 
14          * automatically set.
15          */
16         private long bind = 0;
17         /**
18          * Constructor, opens the file.
19          * @param storage is the name where you can find the file descriptor 
20          * @param path is the file location on the storage 
21          */
22         public File(String storage, String path) {
23                 this.storage = storage;
24                 open(storage, path);
25         }
26         protected void finalize() {
27
28         }
29         /**
30          * Opens the file whose name is the string pointed to by path. 
31          * @param storage is the name where you can find the file descriptor 
32          * @param path is the file location on the storage
33          */
34         protected native void open(String storage, String path);
35         /**
36          * Read elements of a file. 
37          * @param size of each element
38          * @param nMemb is the number of elements of data to write 
39          */
40         public native long read(long size, long nMemb);
41         /**
42          * Write elements into a file. 
43          * @param size of each element  
44          * @param nMemb is the number of elements of data to write 
45          */
46         public native long write(long size, long nMemb);
47         /**
48          * Close the file.      
49          */
50         public native void close();
51         
52         /**
53          * Class initializer, to initialize various JNI stuff
54          */
55         public static native void nativeInit();
56         static {
57                 Msg.nativeInit();
58                 nativeInit();
59         }       
60 }