Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
121 lines (98 loc) · 6.73 KB
/
Copy pathindex.html
File metadata and controls
121 lines (98 loc) · 6.73 KB
<
8000
span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="nw" data-component="Tooltip" aria-hidden="true" id="_R_jecpala9lik5_">Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Jimfs by google</title>
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="wrapper">
<header>
<h1>Jimfs</h1>
<p>An in-memory file system for Java 7+</p>
<p class="view"><a href="https://github.com/google/jimfs">View the Project on GitHub <small>google/jimfs</small></a></p>
<ul>
<li><a href="https://github.com/google/jimfs/zipball/master">Download <strong>ZIP File</strong></a></li>
<li><a href="https://github.com/google/jimfs/tarball/master">Download <strong>TAR Ball</strong></a></li>
<li><a href="https://github.com/google/jimfs">View On <strong>GitHub</strong></a></li>
</ul>
</header>
<section>
<h1>
<a name="jimfs" class="anchor" href="#jimfs"><span class="octicon octicon-link"></span></a>Jimfs</h1>
<p>Jimfs is an in-memory file system for Java 7 and above, implementing the
<a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/package-summary.html">java.nio.file</a>
abstract file system APIs.</p>
<h2>
<a name="getting-started" class="anchor" href="#getting-started"><span class="octicon octicon-link"></span></a>Getting started</h2>
<p>The latest release is <a href="https://github.com/google/jimfs/releases/tag/v1.0">1.0</a>.</p>
<p>It is available in Maven Central as
<a href="http://search.maven.org/#artifactdetails%7Ccom.google.jimfs%7Cjimfs%7C1.0%7Cjar">com.google.jimfs:jimfs:1.0</a>:</p>
<div class="highlight highlight-xml"><pre><span class="nt"><dependency></span>
<span class="nt"><groupId></span>com.google.jimfs<span class="nt"></groupId></span>
<span class="nt"><artifactId></span>jimfs<span class="nt"></artifactId></span>
<span class="nt"><version></span>1.0<span class="nt"></version></span>
<span class="nt"></dependency></span>
</pre></div>
<h2>
<a name="basic-use" class="anchor" href="#basic-use"><span class="octicon octicon-link"></span></a>Basic use</h2>
<p>The simplest way to use Jimfs is to just get a new <code>FileSystem</code> instance from the <code>Jimfs</code> class and
start using it:</p>
<div class="highlight highlight-java"><pre><span class="kn">import</span> <span class="nn">com.google.common.jimfs.Configuration</span><span class="o">;</span>
<span class="kn">import</span> <span class="nn">com.google.common.jimfs.Jimfs</span><span class="o">;</span>
<span class="o">...</span>
<span class="c1">// For a simple file system with Unix-style paths and behavior:</span>
<span class="n">FileSystem</span> <span class="n">fs</span> <span class="o">=</span> <span class="n">Jimfs</span><span class="o">.</span><span class="na">newFileSystem</span><span class="o">(</span><span class="n">Configuration</span><span class="o">.</span><span class="na">unix</span><span class="o">());</span>
<span class="n">Path</span> <span class="n">foo</span> <span class="o">=</span> <span class="n">fs</span><span class="o">.</span><span class="na">getPath</span><span class="o">(</span><span class="s">"/foo"</span><span class="o">);</span>
<span class="n">Files</span><span class="o">.</span><span class="na">createDirectory</span><span class="o">(</span><span class="n">foo</span><span class="o">);</span>
<span class="n">Path</span> <span class="n">hello</span> <span class="o">=</span> <span class="n">foo</span><span class="o">.</span><span class="na">resolve</span><span class="o">(</span><span class="s">"hello.txt"</span><span class="o">);</span> <span class="c1">// /foo/hello.txt</span>
<span class="n">Files</span><span class="o">.</span><span class="na">write</span><span class="o">(</span><span class="n">hello</span><span class="o">,</span> <span class="n">ImmutableList</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"hello world"</span><span class="o">),</span> <span class="n">StandardCharsets</span><span class="o">.</span><span class="na">UTF_8</span><span class="o">);</span>
</pre></div>
<h2>
<a name="whats-supported" class="anchor" href="#whats-supported"><span class="octicon octicon-link"></span></a>What's supported?</h2>
<p>Jimfs supports almost all the APIs under <code>java.nio.file</code>. It supports:</p>
<ul>
<li>Creating, deleting, moving and copying files and directories.</li>
<li>Reading and writing files with <code>FileChannel</code> or <code>SeekableByteChannel</code>, <code>InputStream</code>,
<code>OutputStream</code>, etc.</li>
<li>Symbolic links.</li>
<li>Hard links to regular files.</li>
<li>
<code>SecureDirectoryStream</code>, for operations relative to an <em>open</em> directory.</li>
<li>Glob and regex path filtering with <code>PathMatcher</code>.</li>
<li>Watching for changes to a directory with a <code>WatchService</code>.</li>
<li>File attributes. Built-in attribute views that can be supported include "basic", "owner",
"posix", "unix", "dos", "acl" and "user". Do note, however, that not all attribute views provide
<em>useful</em> attributes. For example, while setting and reading POSIX file permissions is possible
with the "posix" view, those permissions will not actually affect the behavior of the file system.</li>
</ul><p>Jimfs also supports creating file systems that, for example, use Windows-style paths and (to an
extent) behavior. In general, however, file system behavior is modeled after UNIX and may not
exactly match any particular real file system or platform.</p>
<h2>
<a name="license" class="anchor" href="#license"><span class="octicon octicon-link"></span></a>License</h2>
<pre><code>Copyright 2013 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</code></pre>
</section>
<footer>
<p>This project is maintained by <a href="https://github.com/google">google</a></p>
<p><small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
<script src="javascripts/scale.fix.js"></script>
</body>
</html>