{"id":20741135,"url":"https://github.com/robtimus/memory-fs","last_synced_at":"2025-04-24T03:07:23.690Z","repository":{"id":50586924,"uuid":"77142895","full_name":"robtimus/memory-fs","owner":"robtimus","description":"An in-memory NIO.2 file system","archived":false,"fork":false,"pushed_at":"2024-01-20T12:38:25.000Z","size":781,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T03:07:15.657Z","etag":null,"topics":["filesystem","in-memory","java","nio2"],"latest_commit_sha":null,"homepage":"https://robtimus.github.io/memory-fs/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robtimus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-22T12:29:35.000Z","updated_at":"2023-11-22T19:00:16.000Z","dependencies_parsed_at":"2023-02-18T00:01:24.131Z","dependency_job_id":"aa2b53de-3435-4df8-8b67-b39559d359c7","html_url":"https://github.com/robtimus/memory-fs","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fmemory-fs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fmemory-fs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fmemory-fs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fmemory-fs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robtimus","download_url":"https://codeload.github.com/robtimus/memory-fs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250552072,"owners_count":21449164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filesystem","in-memory","java","nio2"],"created_at":"2024-11-17T06:34:05.013Z","updated_at":"2025-04-24T03:07:23.669Z","avatar_url":"https://github.com/robtimus.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memory-fs\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.robtimus/memory-fs)](https://search.maven.org/artifact/com.github.robtimus/memory-fs)\n[![Build Status](https://github.com/robtimus/memory-fs/actions/workflows/build.yml/badge.svg)](https://github.com/robtimus/memory-fs/actions/workflows/build.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=com.github.robtimus%3Amemory-fs\u0026metric=alert_status)](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Amemory-fs)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=com.github.robtimus%3Amemory-fs\u0026metric=coverage)](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Amemory-fs)\n[![Known Vulnerabilities](https://snyk.io/test/github/robtimus/memory-fs/badge.svg)](https://snyk.io/test/github/robtimus/memory-fs)\n\nThe `memory-fs` library provides an in-memory NIO.2 file system. It can be used where a NIO.2 file system implementation is required, without needing to write anything to disk.\n\n## Creating paths\n\nIf the in-memory file system library is available on the class path, it will register a [FileSystemProvider](https://docs.oracle.com/javase/8/docs/api/java/nio/file/spi/FileSystemProvider.html) for scheme `memory`. This means that, to create a [Path](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html) for the in-memory file system, you can simply use [Paths.get](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Paths.html#get-java.net.URI-):\n\n    Path path = Paths.get(URI.create(\"memory:/foo/bar\"));\n\n## Attributes\n\n### File attributes\n\nThe in-memory file system fully supports the attributes defined in [BasicFileAttributeView](https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/BasicFileAttributeView.html) and [BasicFileAttributes](https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/BasicFileAttributes.html). These are available both with and without prefix `basic:`.\n\nBesides these attributes, the in-memory file system provides two extra attributes:\n\n* `readOnly`: if a file or directory is read only, its contents cannot be modified. For a directory this means that the list of child files and directories cannot be modified. The child files and directories themselves can still be modified if they are not read only.\n* `hidden`: files and directories can be hidden, allowing the hidden attribute to be used for filtering.\n\nThese attributes are accessible through interfaces [MemoryFileAttributeView](https://robtimus.github.io/memory-fs/apidocs/com/github/robtimus/filesystems/memory/MemoryFileAttributeView.html) and [MemoryFileAttributes](https://robtimus.github.io/memory-fs/apidocs/com/github/robtimus/filesystems/memory/MemoryFileAttributes.html) (which extend [BasicFileAttributeView](https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/BasicFileAttributeView.html) and [BasicFileAttributes](https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/BasicFileAttributes.html) respectively), or with prefix `memory:` (e.g. `memory:hidden`). The basic attributes are also available using prefix `memory:`.\n\n### File store attributes\n\nWhen calling [getAttribute](https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileStore.html#getAttribute-java.lang.String-) on a file store, the following attributes are supported:\n\n* `totalSpace`: returns the same value as the [getTotalSpace](https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileStore.html#getTotalSpace--) method, based on the contents of the in-memory file system.\n* `usableSpace`: returns the same value as the [getUsableSpace](https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileStore.html#getUsableSpace--) method, which is based on the maximum amount of memory available to the JVM.\n* `unallocatedSpace`: returns the same value as the [getUnallocatedSpace](https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileStore.html#getUnallocatedSpace--) method, which is based on the amount of free memory in the JVM.\n\nThere is no support for [FileStoreAttributeView](https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/FileStoreAttributeView.html). Calling [getFileStoreAttributeView](https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileStore.html#getFileStoreAttributeView-java.lang.Class-) on a file store will simply return `null`.\n\n## Thread safety\n\nMost operations are atomic and thread safe. Concurrent access to files using streams or channels may give unexpected results though. If concurrent access to files is necessary, it is suggested to use proper synchronisation.\n\n## Limitations\n\nThe in-memory file system knows the following limitations:\n\n* All paths use `/` as separator. `/` is not allowed inside file or directory names.\n* Symbolic links can only be nested up to 100 times.\n* Files are never executable. Calling [checkAccess](https://docs.oracle.com/javase/8/docs/api/java/nio/file/spi/FileSystemProvider.html#checkAccess-java.nio.file.Path-java.nio.file.AccessMode...-) on a file with [AccessMode.EXECUTE](https://docs.oracle.com/javase/8/docs/api/java/nio/file/AccessMode.html#EXECUTE) will cause an [AccessDeniedException](https://docs.oracle.com/javase/8/docs/api/java/nio/file/AccessDeniedException.html) to be thrown.\n* There is only one file system. Any attempt to create a new one will fail.\n* There is no support for [UserPrincipalLookupService](https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/UserPrincipalLookupService.html).\n* There is no support for [WatchService](https://docs.oracle.com/javase/8/docs/api/java/nio/file/WatchService.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtimus%2Fmemory-fs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtimus%2Fmemory-fs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtimus%2Fmemory-fs/lists"}