ultraq / redhorizon

Recreating the original 2D Command & Conquer games
Apache License 2.0
6 stars 4 forks source link

Use blocking IO for reading into the C&C file types #16

Closed ultraq closed 4 years ago

ultraq commented 4 years ago

When I started this all out, the idea of non-blocking IO (the java.nio package) for reading file data seemed like a good idea, but the way I've coded things is to always expect X bytes to be read from the input which the blocking IO classes (java.io) would more likely guarantee.

Experiment with java.io for one of the files and see how it fits. Namely, use the DataInput interfaces since they let me read primitives from the input stream easily.

ultraq commented 4 years ago

Works pretty well, will apply to other file types as I add them.