```java
package com.gosuncn;
import java.io.FileInputStream;
import java.io.IOException;
public class JavaIOInputStream {
public static final String SOURCE_FILENAME = "C:\\Users\\Administrator\\Desktop\\UTF8.txt";
public static void main(String[] args) throws Exception {
markSupported(new FileInputStream(SOURCE_FILENAME));
}
public static void read1(FileInputStream inputStream) throws IOException {
int data = inputStream.read(); // 用int接收一个byte数据,若data=-1则文件读取完毕
}
public static void read2(FileInputStream inputStream) throws IOException {
byte[] buffer = new byte[1024];
int len = inputStream.read(buffer); // len表示读取字节的长度,若len=-1则文件读取完毕
}
public static void read3(FileInputStream inputStream) throws IOException {
byte[] buffer = new byte[1024];
/**
* len 表示读取字节的长度,若 len=-1 则文件读取完毕.
* off 表示在向 buffer 中存数据时,偏移的字节数.
* len 表示在向 buffer 中存数据时,存放的字节数(Java根据len从流中读取一定数量的字节).
*/
int len = inputStream.read(buffer, 2, 1);
}
public static void skip(FileInputStream inputStream) throws IOException {
long skip = inputStream.skip(9L); // 跳过指定字节数,底层指针往下移动指定字节数.
}
public static void available(FileInputStream inputStream) throws IOException {
int available = inputStream.available(); // 返回可读的字节数量
}
public static void close(FileInputStream inputStream) throws IOException {
inputStream.close(); // 关闭流
}
public static void markSupported(FileInputStream inputStream) {
/**
* 查询是否支持标记
* 如果支持标记,可以通过mark(int)方法进行标记.
* 标记成功以后,可以通过reset()方法返回上次标记位置.
*/
boolean markSupported = inputStream.markSupported();
}
}
```