dan200 / ComputerCraft

Programmable Computers for Minecraft
Other
964 stars 199 forks source link

Rewrite file systems to use ByteChannels #575

Open SquidDev opened 5 years ago

SquidDev commented 5 years ago

This replaces the existing IMount openFor* method with openChannelFor* ones, which return an appropriate byte channel instead. I've put a little more detail in the commit message about the implications of this, but there's a couple of user-facing benefits:

SquidDev commented 5 years ago

Possibly worth noting that seekable binary handles do not work for Jar mounts - namely the rom and any treasure disks.

It would be possible to implement this by reading the entire contents of the file into memory and exposing it as an ArrayByteChannel, but I think it's worth discussing whether it's worth it.