20230621 java.io.FileInputStream

发布时间 2023-08-29 17:06:01作者: 流星<。)#)))≦

介绍

  • java.io.FileInputStream
  • public class FileInputStream extends InputStream
  • 提供附着在一个磁盘文件上的输入流
  • 在 java.io 中的类都将相对路径名解释为以用户工作目录开始,可以通过调用 System.getProperty("user.dir") 来获得这个信息
    • JDK 的路径不兼容 Maven 结构,不过常用的框架会兼容,比如 Spring , Hutool
  • 文件分隔符 java.io.File.separator

API

构造器

  • FileInputStream(String name) throws FileNotFoundException
  • FileInputStream(File file) throws FileNotFoundException
  • FileInputStream(FileDescriptor fdObj)

API

  • getFD
    • final FileDescriptor getFD() throws IOException
  • getChannel
    • FileChannel getChannel()