有没有办法创建具有标记功能的 FileInputStream?
有没有可能的方法来创建 FileInputStream
并将支持的功能标记为 true
?
Is there any possible way to create FileInputStream
with mark supported feature as true
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(4)
匿名。2024-11-04 05:40:18
将其包装在 BufferedInputStream
。
而不是
FileInputStream fis = new FileInputStream(...);
这样做:
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(...));
并使用 bis
而不是 fis
;您的代码中不需要更改任何其他内容。
丶视觉2024-11-04 05:40:18
尝试这样的事情
public FileInputStream fstream;
public DataInputStream in;
public BufferedInputStream bs;
public String path;
public void myExample() throws IOException{
path = "yourPath";
try {
fstream = new FileInputStream(path);
in = new DataInputStream(fstream);
bs = new BufferedInputStream(new InputStreamReader(in));
//do something
br.close(); //when do something is completed
} catch (FileNotFoundException ex) {
JOptionPane.showMessageDialog(null, "File not found");
}
}
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
将 Fileinputstream 包装在 BufferedInputStream 中。
缓冲流支持标记。
Wrap your Fileinputstream inside a BufferedInputStream.
The buffered streams support marks.