Yes. Even if the file was not written by a Java program you can write a program to input the raw bytes and arrange them into what (you guess) is their intended order.
To read a file about which you have little information
you need to make some intelligent guesses.
If the file was written by a Java program then
you need to know what data type is used
in the file.
Then you can use a subclass of InputStream
to read bytes for that data type.
If the file contains several data types and
you don't know the order they were written,
the problem is more difficult.
The diagram shows InputStream
and some of
its subclasses.
Not all of these streams are concerned with input
from disk files.
For example, PipedInputStream
represents data coming in from another running program.
If a file was written with DataOutputStream
,
what input stream do you suspect will be useful?