View Javadoc
1   /*
2    * Copyright (C) 2005-2015 Schlichtherle IT Services.
3    * All rights reserved. Use is subject to license terms.
4    */
5   package net.java.truevfs.kernel.spec;
6   
7   import java.io.IOException;
8   import javax.annotation.concurrent.Immutable;
9   
10  /**
11   * Defines common access options for I/O operations.
12   * Not all options may be supported or available for all operations and
13   * certain combinations may even be illegal.
14   * It's up to the particular operation and file system driver implementation
15   * to define which options are supported and available.
16   * If an option is not supported, it should get silently ignored.
17   * If an option is not available or illegal, an {@link IOException} must get
18   * thrown.
19   *
20   * @author Christian Schlichtherle
21   */
22  @Immutable
23  public enum FsAccessOption {
24  
25      /** Whether or not a file system node must be exclusively created. */
26      EXCLUSIVE,
27  
28      /**
29       * Whether or not the contents of an existing file system node shall get
30       * kept for appending rather than replaced for overwriting.
31       */
32      APPEND,
33  
34      /**
35       * Whether or not the entry data shall get cached for subsequent access.
36       * As a desired side effect, caching allows a federated file system (i.e.
37       * prospective archive file) to {@link FsController#sync} its contents to
38       * its parent file system while some client is still busy on reading
39       * or writing the cached entry data.
40       */
41      CACHE,
42  
43      /**
44       * Whether or not any missing parent directory entries shall get created
45       * automatically with an undefined last modification time.
46       */
47      CREATE_PARENTS,
48  
49      /**
50       * Expresses a preference to allow an archive file to grow by appending any
51       * new or updated archive entry contents or meta data to its end.
52       * Setting this option may produce redundant data in the resulting archive
53       * file.
54       * However, it may yield much better performance if the number and contents
55       * of the archive entries to create or update are rather small compared to
56       * the total size of the resulting archive file.
57       * <p>
58       * This option is the equivalent to a multi-session disc (CD, DVD etc.)
59       * for archive files.
60       * <p>
61       * Note that this option may get ignored by archive file system drivers.
62       * Furthermore, if this happens, there may be no direct feedback available
63       * to the caller.
64       */
65      GROW,
66  
67      /**
68       * Expresses a preference to store an entry uncompressed within its archive.
69       * <p>
70       * Note that this option may get ignored by archive file system drivers.
71       * Furthermore, if this happens, there may be no direct feedback available
72       * to the caller.
73       */
74      STORE,
75  
76      /**
77       * Expresses a preference to compress an entry within its archive.
78       * <p>
79       * Note that this option may get ignored by archive file system drivers.
80       * Furthermore, if this happens, there may be no direct feedback available
81       * to the caller.
82       */
83      COMPRESS,
84  
85      /**
86       * Expresses a preference to encrypt archive entries when writing them to
87       * an archive file.
88       * <p>
89       * Note that this option may get ignored by archive file system drivers.
90       * Furthermore, if this happens, there may be no direct feedback available
91       * to the caller.
92       */
93      ENCRYPT,
94  }