Coder Social home page Coder Social logo

Comments (5)

robtimus avatar robtimus commented on July 30, 2024

I will see what is possible here. The main issue is that FileChannel adds more responsibilities. Some parts are quite easy to do because FileChannel implements SeekableByteChannel which is already supported. The most work will be in adding not just the locking methods, but also the map method.

from memory-fs.

robtimus avatar robtimus commented on July 30, 2024

I've been investigating this, but I'm not sure it's possible to implement support for FileChannel while still following the official contract. The problem lies with the map method. It must return a MappedByteBuffer, but this class has no available sub classes, and because it has no public or protected constructors it's also impossible to create my own sub class.

I could implement FileChannel minus the map method, but that's where the contract is limiting me - the method itself does not document that I'm allowed to throw an exception. FileSystemProvider even disallows it. From its newFileChannel method documentation:

A provider that does not support all the features required to construct a file channel throws UnsupportedOperationException.

from memory-fs.

gadton avatar gadton commented on July 30, 2024

That's really weird! Seems that no one should provide another FileChannel without placing at least one class into one of the java.nio.* packages.
I would think providing FileChannel minus map would be ok as I understand the spec in a different way. I think it means that the provider should throw UOE if it does not support at least one feature regardless if the created channel provides all the features.

from memory-fs.

robtimus avatar robtimus commented on July 30, 2024

Out of curiosity, I have checked the implementation of jdk.nio.zipfs.ZipFileSystemProvider. This delegates indirectly to jdk.nio.zipfs.ZipFileSystem. This returns a FileChannel which all methods of FileChannel minus map, which throws an UOE. That means that you are probably right - if one of the default implementations can do it, so can other implementations.

from memory-fs.

robtimus avatar robtimus commented on July 30, 2024

I've just released version 1.2 with FileChannel support minus the map method.

from memory-fs.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.