Get the size of a resource

后端 未结 3 496
误落风尘
误落风尘 2021-01-18 05:28

I\'m using getClass().getResourceAsStream(path) to read from bundle resources.

How can I know the file size before reading the entire stream?

I

3条回答
  •  猫巷女王i
    2021-01-18 06:04

    This question has some specific solutions: How do I list the files inside a JAR file?, specifically, using a FileSystem API since Java 7.

    It should work for files in a JAR and unpacked files. I'm not sure it will work for a JAR packed in a WAR, for instance.

提交回复
热议问题