Quantcast
Viewing all articles
Browse latest Browse all 5648

How to deserialize java resource file in the jar package?

In C# version, there is an API:
IFileReader<T> OpenReader(Stream inStream)
which require only a "Stream" object.

However in java version, it requires a "SeekableInput":
FileReader<D> openReader(SeekableInput in, DatumReader<D> reader)

Now that the data is in the resource file which is embedded in the jar
package,
we can only get a stream using getResourceAsStream() method,
how can we deserialize the data?

I also wonder why are the APIs different between C# and java version.
Could there also be an API requiring only a Stream object in java, which I
think
would be quite convenient.

Viewing all articles
Browse latest Browse all 5648

Trending Articles