Yes. Even if the file was not written by a Java program you can write a program to input the raw bytes and combine them into what (you guess) is their intended data type.
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 types were used.
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.
InputStream
is an abstract class
(shown as a dotted cloud)
for objects that read streams of bytes.
Not all of these classes 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?