Can you create a File object in Java without saving to hard disk?
All the constructors for java.io.File seem to take info about a location on disk.
Can you create a File object in Java without saving to hard disk?
All the constructors for java.io.File seem to take info about a location on disk.
A File object is not a file. It is a path to a location on disk with some utility methods. This location need not exist to have a valid file. For instance, you can do File#createNewFile to create a physical file after creating a File object that would point to that pathname on disk.
Use URL and related classes to read remotely, or some sort of java.nio.ByteBuffer to store file data in memory.