Logo AND Algorithmique Numérique Distribuée

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