Any available in-memory FileSystem implementations for Java7 nio2?
Asked Answered
H

4

9

I was looking for in-memory nio2 FileSystem implementations, that would allow me to more easily test my IO-dependent code.

It seems natively, Java only provides (in my JDK) a Win32FileSystem and a ZipFileSystem.

It seems ShrinkWrap has something of the kind, but seems to mainly deal with ZIP File Systems or whatsoever.

I'd guess by the time being, some of you are already incorporating the new nio FileSystem IO in your own projects and could help me with this?

Thanks

Hydrated answered 20/10, 2012 at 11:50 Comment(2)
can't you use mocks? plz provide some code example that requires filesystem to testDefoliant
ShrinkWrap seems to have a blog post advertising an in memory fs ( exitcondition.alrubinger.com/2012/08/17/shrinkwrap-nio2 ) however it doesn't seem to work correct :( (Files.isDirectory() returns false for directories)Gilbertson
O
9

https://github.com/google/jimfs provides this functionality. I never tested it myself.

Onomasiology answered 27/2, 2014 at 16:7 Comment(0)
B
1

You can try https://github.com/marschall/memoryfilesystem. Should be a perfect fit for your needs.

Boost answered 16/1, 2014 at 16:18 Comment(0)
A
0

ShrinkWrap does indeed have an NIO.2 in-memory filesystem implementation, and the directory reporting as "false" issue noted by Patrick has been fixed (by him. :) ): https://github.com/shrinkwrap/shrinkwrap/commit/3319e64c455a5f0e601b19066318d28c4bea3df1

S, ALR

Adim answered 19/6, 2013 at 10:54 Comment(0)
F
0

https://github.com/openCage/memoryfs is such an in-memory filesystem. It implements most but not yet all of the nio2 API.

Note: I am the author. Let me know if you find a bug or need a feature.

Farriery answered 24/1, 2014 at 11:5 Comment(1)
Thanks for you efforts! How does it compare to google/jimfs and marschall/memoryfilesystem?Demobilize

© 2022 - 2024 — McMap. All rights reserved.