'Is there any way to convert File object to DataInputStream Object in Java?

I have a object of File and I want to convert it into a DataInputStream Object. is there any way to do it?

I have these objects.

        FileOutputStream fos;
        File outputFile;
        outputFile = File.createTempFile("temp", ".xlsx");
        fos = new FileOutputStream(outputFile);

after that i am writing the data into file

excel.write(fos);
fos.close();

Now, I want to convert the file into the DataInputStream object. How can I do it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source