Class Options


  • final class Options
    extends java.lang.Object
    Utility methods for normalizing user-provided options arrays and sets to canonical immutable sets of options.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> DEFAULT_READ  
      private static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> DEFAULT_READ_NOFOLLOW_LINKS  
      private static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> DEFAULT_WRITE  
      static com.google.common.collect.ImmutableSet<java.nio.file.LinkOption> FOLLOW_LINKS
      Immutable empty LinkOption set.
      static com.google.common.collect.ImmutableSet<java.nio.file.LinkOption> NOFOLLOW_LINKS
      Immutable set containing LinkOption.NOFOLLOW_LINKS.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Options()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> addWrite​(java.util.Collection<? extends java.nio.file.OpenOption> options)
      Returns an ImmutableSet copy of the given options, adding StandardOpenOption#WRITE if it isn't already present.
      static com.google.common.collect.ImmutableSet<java.nio.file.CopyOption> getCopyOptions​(java.nio.file.CopyOption... options)
      Returns an immutable set of the given options for a copy.
      static com.google.common.collect.ImmutableSet<java.nio.file.LinkOption> getLinkOptions​(java.nio.file.LinkOption... options)
      Returns an immutable set of link options.
      static com.google.common.collect.ImmutableSet<java.nio.file.CopyOption> getMoveOptions​(java.nio.file.CopyOption... options)
      Returns an immutable set of the given options for a move.
      static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> getOptionsForChannel​(java.util.Set<? extends java.nio.file.OpenOption> options)
      Returns an immutable set of open options for opening a new file channel.
      static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> getOptionsForInputStream​(java.nio.file.OpenOption... options)
      Returns an immutable set of open options for opening a new input stream.
      static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> getOptionsForOutputStream​(java.nio.file.OpenOption... options)
      Returns an immutable set of open options for opening a new output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NOFOLLOW_LINKS

        public static final com.google.common.collect.ImmutableSet<java.nio.file.LinkOption> NOFOLLOW_LINKS
        Immutable set containing LinkOption.NOFOLLOW_LINKS.
      • FOLLOW_LINKS

        public static final com.google.common.collect.ImmutableSet<java.nio.file.LinkOption> FOLLOW_LINKS
        Immutable empty LinkOption set.
      • DEFAULT_READ

        private static final com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> DEFAULT_READ
      • DEFAULT_READ_NOFOLLOW_LINKS

        private static final com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> DEFAULT_READ_NOFOLLOW_LINKS
      • DEFAULT_WRITE

        private static final com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> DEFAULT_WRITE
    • Constructor Detail

      • Options

        private Options()
    • Method Detail

      • getLinkOptions

        public static com.google.common.collect.ImmutableSet<java.nio.file.LinkOption> getLinkOptions​(java.nio.file.LinkOption... options)
        Returns an immutable set of link options.
      • getOptionsForChannel

        public static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> getOptionsForChannel​(java.util.Set<? extends java.nio.file.OpenOption> options)
        Returns an immutable set of open options for opening a new file channel.
      • getOptionsForInputStream

        public static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> getOptionsForInputStream​(java.nio.file.OpenOption... options)
        Returns an immutable set of open options for opening a new input stream.
      • getOptionsForOutputStream

        public static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> getOptionsForOutputStream​(java.nio.file.OpenOption... options)
        Returns an immutable set of open options for opening a new output stream.
      • addWrite

        private static com.google.common.collect.ImmutableSet<java.nio.file.OpenOption> addWrite​(java.util.Collection<? extends java.nio.file.OpenOption> options)
        Returns an ImmutableSet copy of the given options, adding StandardOpenOption#WRITE if it isn't already present.
      • getMoveOptions

        public static com.google.common.collect.ImmutableSet<java.nio.file.CopyOption> getMoveOptions​(java.nio.file.CopyOption... options)
        Returns an immutable set of the given options for a move.
      • getCopyOptions

        public static com.google.common.collect.ImmutableSet<java.nio.file.CopyOption> getCopyOptions​(java.nio.file.CopyOption... options)
        Returns an immutable set of the given options for a copy.