FileInputStream


FileINputStream
FileInputStream,:This stream is not buffered. Most callers should wrap this stream with a BufferedInputStream.
這個流不緩衝,絕大多數情況下使用BufferedInputStream來包裝
比如讀取一個文件Flie sdCardDir=Environment.getExternalStorageDirectonry();

1)構造器
ileInputStream(File file)
Constructs a new FileInputStream that reads from file.

FileInputStream(FileDescriptor fd)//可以補考慮
Constructs a new FileInputStream that reads from fd.

FileInputStream(String path)//根據文件路徑獲取對應的流
Equivalent to new FileInputStream(new File(path)).
2)方法
int available()
Returns an estimated number of bytes that can be read or skipped without blocking for more input.
void close()
Closes this stream.
int read()
Reads a single byte from this stream and returns it as an integer in the range from 0 to 255.
int read(byte[] buffer, int byteOffset, int byteCount)
Reads up to byteCount bytes from this stream and stores them in the byte array buffer starting at byteOffset.
long skip(long byteCount)
Skips at most n bytes in this stream.




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章