Logo AND Algorithmique Numérique Distribuée

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