FileInputStream

package cm;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class test20180422FileInputStream {

	public static void main(String[] args) throws FileNotFoundException {
		//Inherited from class Inputstream
		File f=new File("D:\\");
		FileInputStream fis=new FileInputStream(f);
		
		try {
			fis.read();//Read a data byte from this input stream. This method will block if no input is available.
			byte[]b=new byte[4];
			fis.read(b);//Read up to len bytes of data from this input stream into a byte array. If len is not 0, the method blocks until input is available; otherwise, no bytes are read and 0 is returned.
		    fis.skip(3L);//Skip and discard n bytes of data from the input stream, for various reasons, the skip method may end up skipping fewer bytes, possibly even 0. Throws an IOException if n is negative,
		
		} catch (IOException e) {
			e.printStackTrace ();
		}
		
			

	}

}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324621830&siteId=291194637