|
From: <de...@us...> - 2003-03-18 11:04:46
|
Update of /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/fortran
In directory sc8-pr-cvs1:/tmp/cvs-serv18675/dodico/src/org/fudaa/dodico/fortran
Modified Files:
FortranBinaryInputStream.java
Log Message:
ajout commentaires + optimisation
Index: FortranBinaryInputStream.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/fortran/FortranBinaryInputStream.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FortranBinaryInputStream.java 21 Feb 2003 16:00:38 -0000 1.2
--- FortranBinaryInputStream.java 18 Mar 2003 11:04:43 -0000 1.3
***************
*** 16,58 ****
* Une classe facilitant la lecture de fichiers binaires écrits par Fortran
* L'équivalence d'intructions entre Java et Fortran se fera de la manière
! * suivante :<BR><PRE>
* (en considérant i=integer/int, f=real/float, d=double precision/double et
! * s=character*()/String)
! * 1) Pour un fichier à acces séquentiel :
! * Fortran
! * open (unit=10,file='fichier.bin',access='sequentiel',form='unformatted')
! * read (unit=10) <i>,<f>,<d>,<s>
! * ...
! * close (unit=10)
! * Java
! * FortranBinaryInputStream in=
! * new FortranBinaryInputStream(new FileInputStream("fichier.bin"),true);
! * in.readRecord();
! * i=in.readInteger();
! * f=in.readReal();
! * d=in.readDoublePrecision();
! * s=in.readCharacter(s.length());
! * ...
! * in.close();
! * 2) Pour un fichier à acces direct :
! * Fortran
! * open (unit=10,file='fichier.bin',access='direct',recl=30,form='unformatted')
! * read (unit=10,rec=1) <i>,<f>,<d>,<s>
! * ...
! * close (unit=10)
! * Java
! * FortranBinaryInputStream in=
! * new FortranBinaryInputStream(new FileInputStream("fichier.bin"),false);
! * in.setRecordLength(30);
! * in.readRecord();
! * i=in.readInteger();
! * f=in.readReal();
! * d=in.readDoublePrecision();
! * s=in.readCharacter(s.length());
! * ...
! * in.close();
! * </PRE>
*
! * @version $Revision$ $Date$ by $Author$
* @author Bertrand Marchand
*/
--- 16,72 ----
* Une classe facilitant la lecture de fichiers binaires écrits par Fortran
* L'équivalence d'intructions entre Java et Fortran se fera de la manière
! * suivante :<BR>
* (en considérant i=integer/int, f=real/float, d=double precision/double et
! * s=character*()/String)<BR>
! * <br>
! * <b>1) Pour un fichier à acces séquentiel :</b><BR><BR>
! * <b>Fortran</b><BR>
! * <i>
! * open (unit=10,file='fichier.bin',access='sequentiel',form='unformatted')<BR>
! * read (unit=10)<BR>
! * ...<BR>
! * close (unit=10)<BR>
! * </i><BR><BR>
! *
! * <b>Java</b><BR>
! * <i>
! * FortranBinaryInputStream in=<BR>
! * new FortranBinaryInputStream(new FileInputStream("fichier.bin"),true);<BR>
! * in.readRecord();<BR>
! * i=in.readInteger();<BR>
! * f=in.readReal();<BR>
! * d=in.readDoublePrecision();<BR>
! * s=in.readCharacter(s.length());<BR>
! * ...<BR>
! * in.close();<BR>
! * </i>
! * <b>2) Pour un fichier à acces direct :</b><br/>
! * <b>Fortran</b><br/>
! * <i>
! * open (unit=10,file='fichier.bin',access='direct',recl=30,form='unformatted')<br/>
! * read (unit=10,rec=1) <br/>
! * ...<br/>
! * close (unit=10)<br/>
! * </i>
! * <br>
! * <b>Java</b><br>
! * FortranBinaryInputStream in=<br>
! * new FortranBinaryInputStream(new FileInputStream("fichier.bin"),false);<br>
! * in.setRecordLength(30);<br>
! * in.readRecord();<br>
! * i=in.readInteger();<br>
! * f=in.readReal();<br>
! * d=in.readDoublePrecision();<br>
! * s=in.readCharacter(s.length());<br>
! * ...<br>
! * in.close();<br>
*
! * Dans le cas acces sequentiel, un compteur permet de se positionner
! * dans le flux. Il faut faire attention lors de l'utilisation des methodes
! * mark et reset (par exemple) sur le inputstream donne en entree. le compteur
! * peut devenir faux.
! *
! *
! * @version $Id$
* @author Bertrand Marchand
*/
***************
*** 107,110 ****
--- 121,125 ----
* ATTENTION Different du cas acces direct.
* Renvoie la taille de l'enregistrement lu par le flux.
+ * see #getRecordLength()
*/
public int getSequentialRecordLength()
***************
*** 113,116 ****
--- 128,132 ----
}
+
/**
* Affectation de la longueur des enregistrements (pour les fichiers à accès
***************
*** 134,141 ****
*/
public String readCharacter(int _lgString) throws IOException {
- byte[] buf=new byte[_lgString];
currentPos_+=_lgString;
! read(buf);
! return new String(buf);
}
--- 150,155 ----
*/
public String readCharacter(int _lgString) throws IOException {
currentPos_+=_lgString;
! return super.readCharacter(_lgString);
}
***************
*** 261,264 ****
--- 275,280 ----
+
+
/**
***************
*** 279,281 ****
--- 295,306 ----
}
}
+ /**
+ * Renvoie la position courante dans le flux.
+ * @return long
+ */
+ public int getCurrentPosition()
+ {
+ return (int)currentPos_;
+ }
+
}
|