Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[java] fix some small issues found by SonarQube
[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         @Override
24         protected void finalize() {
25
26         }
27         /**
28          * Opens the file whose name is the string pointed to by path.  
29          * @param path is the file location on the storage
30          */
31         protected native void open(String path);
32         /**
33          * Read elements of a file. 
34          * @param size of each element
35          * @param nMemb is the number of elements of data to write 
36          */
37         public native long read(long size, long nMemb);
38         /**
39          * Write elements into 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 write(long size, long nMemb);
44         /**
45          * Close the file.      
46          */
47         public native void close();
48
49         /** Class initializer, to initialize various JNI stuff */
50         public static native void nativeInit();
51         static {
52                 org.simgrid.NativeLib.nativeInit();
53                 nativeInit();
54         }       
55 }