Home > Back-end >  Who help me take a look at why using byte stream photos or show is not successful???????
Who help me take a look at why using byte stream photos or show is not successful???????

Time:03-03

Package dimo;


import java.io.FileInputStream;
import java.io.IOException;
Import the Java. IO. FileOutputStream;
Public class dome {


Public static void main (String [] args) throws IOException {
//create
FileInputStream ol=new FileInputStream (" dimo/123 JPG ");
FileOutputStream Po=new FileOutputStream (" dimo/a. pg ");
//cycle
int len;
While ((len=ol. Read ())!=1); {
Po. Write (len);
}
Ol. Close ();
Po. The close ();
}
}

CodePudding user response:

(len=ol. Read (), read the return value of this method is byte integers, but what we need is this type byte bytes, transport in the past, of course, it is not a picture, you switch to read (byte [] byte) this method, read the data to byte array, and then put the written to another file,
  • Related