KIE NIO.2 :: API 6.0.0.Beta3

org.kie.commons.java.nio.file
Class Files

java.lang.Object
  extended by org.kie.commons.java.nio.file.Files

public final class Files
extends Object

Back port of JSR-203 from Java Platform, Standard Edition 7.

See Also:
Original JavaDoc

Method Summary
static long copy(InputStream in, Path target, CopyOption... options)
           
static long copy(Path source, OutputStream out)
           
static Path copy(Path source, Path target, CopyOption... options)
           
static Path createDirectories(Path dir, FileAttribute<?>... attrs)
           
static Path createDirectory(Path dir, FileAttribute<?>... attrs)
           
static Path createFile(Path path, FileAttribute<?>... attrs)
           
static Path createLink(Path link, Path existing)
           
static Path createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs)
           
static Path createTempDirectory(Path dir, String prefix, FileAttribute<?>... attrs)
           
static Path createTempDirectory(String prefix, FileAttribute<?>... attrs)
           
static Path createTempFile(Path dir, String prefix, String suffix, FileAttribute<?>... attrs)
           
static Path createTempFile(String prefix, String suffix, FileAttribute<?>... attrs)
           
static void delete(Path path)
           
static boolean deleteIfExists(Path path)
           
static boolean exists(Path path, LinkOption... options)
           
static Object getAttribute(Path path, String attribute, LinkOption... options)
           
static
<V extends FileAttributeView>
V
getFileAttributeView(Path path, Class<V> type, LinkOption... options)
           
static FileStore getFileStore(Path path)
           
static FileTime getLastModifiedTime(Path path, LinkOption... options)
           
static UserPrincipal getOwner(Path path, LinkOption... options)
           
static Set<PosixFilePermission> getPosixFilePermissions(Path path, LinkOption... options)
           
static boolean isDirectory(Path path, LinkOption... options)
           
static boolean isExecutable(Path path)
           
static boolean isHidden(Path path)
           
static boolean isReadable(Path path)
           
static boolean isRegularFile(Path path, LinkOption... options)
           
static boolean isSameFile(Path path, Path path2)
           
static boolean isSymbolicLink(Path path)
           
static boolean isWritable(Path path)
           
static Path move(Path source, Path target, CopyOption... options)
           
static BufferedReader newBufferedReader(Path path, Charset cs)
           
static BufferedWriter newBufferedWriter(Path path, Charset cs, OpenOption... options)
           
static SeekableByteChannel newByteChannel(Path path, OpenOption... options)
           
static SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
           
static DirectoryStream<Path> newDirectoryStream(Path dir)
           
static DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<Path> filter)
           
static DirectoryStream<Path> newDirectoryStream(Path dir, String glob)
           
static InputStream newInputStream(Path path, OpenOption... options)
           
static OutputStream newOutputStream(Path path, OpenOption... options)
           
static boolean notExists(Path path, LinkOption... options)
           
static String probeContentType(Path path)
           
static byte[] readAllBytes(Path path)
           
static List<String> readAllLines(Path path, Charset cs)
           
static
<A extends BasicFileAttributes>
A
readAttributes(Path path, Class<A> type, LinkOption... options)
           
static Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options)
           
static Path readSymbolicLink(Path link)
           
static Path setAttribute(Path path, String attribute, Object value, LinkOption... options)
           
static Path setLastModifiedTime(Path path, FileTime time)
           
static Path setOwner(Path path, UserPrincipal owner)
           
static Path setPosixFilePermissions(Path path, Set<PosixFilePermission> perms)
           
static long size(Path path)
           
static Path walkFileTree(Path start, FileVisitor<Path> visitor)
           
static Path walkFileTree(Path start, Set<FileVisitOption> options, int maxDepth, FileVisitor<Path> visitor)
           
static Path write(Path path, byte[] bytes, OpenOption... options)
           
static Path write(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInputStream

public static InputStream newInputStream(Path path,
                                         OpenOption... options)
                                  throws IllegalArgumentException,
                                         NoSuchFileException,
                                         UnsupportedOperationException,
                                         IOException,
                                         SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
NoSuchFileException
IOException
SecurityException
See Also:
Original JavaDoc

newOutputStream

public static OutputStream newOutputStream(Path path,
                                           OpenOption... options)
                                    throws IllegalArgumentException,
                                           UnsupportedOperationException,
                                           IOException,
                                           SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
IOException
SecurityException
See Also:
Original JavaDoc

newByteChannel

public static SeekableByteChannel newByteChannel(Path path,
                                                 OpenOption... options)
                                          throws IllegalArgumentException,
                                                 UnsupportedOperationException,
                                                 FileAlreadyExistsException,
                                                 IOException,
                                                 SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
FileAlreadyExistsException
IOException
SecurityException
See Also:
Original JavaDoc

newByteChannel

public static SeekableByteChannel newByteChannel(Path path,
                                                 Set<? extends OpenOption> options,
                                                 FileAttribute<?>... attrs)
                                          throws IllegalArgumentException,
                                                 UnsupportedOperationException,
                                                 FileAlreadyExistsException,
                                                 IOException,
                                                 SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
FileAlreadyExistsException
IOException
SecurityException
See Also:
Original JavaDoc

newDirectoryStream

public static DirectoryStream<Path> newDirectoryStream(Path dir)
                                                throws IllegalArgumentException,
                                                       NotDirectoryException,
                                                       IOException,
                                                       SecurityException
Throws:
IllegalArgumentException
NotDirectoryException
IOException
SecurityException
See Also:
Original JavaDoc

newDirectoryStream

public static DirectoryStream<Path> newDirectoryStream(Path dir,
                                                       String glob)
                                                throws IllegalArgumentException,
                                                       UnsupportedOperationException,
                                                       PatternSyntaxException,
                                                       NotDirectoryException,
                                                       IOException,
                                                       SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
PatternSyntaxException
NotDirectoryException
IOException
SecurityException

newDirectoryStream

public static DirectoryStream<Path> newDirectoryStream(Path dir,
                                                       DirectoryStream.Filter<Path> filter)
                                                throws IllegalArgumentException,
                                                       NotDirectoryException,
                                                       IOException,
                                                       SecurityException
Throws:
IllegalArgumentException
NotDirectoryException
IOException
SecurityException
See Also:
Original JavaDoc

createFile

public static Path createFile(Path path,
                              FileAttribute<?>... attrs)
                       throws IllegalArgumentException,
                              UnsupportedOperationException,
                              FileAlreadyExistsException,
                              IOException,
                              SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
FileAlreadyExistsException
IOException
SecurityException
See Also:
Original JavaDoc

createDirectory

public static Path createDirectory(Path dir,
                                   FileAttribute<?>... attrs)
                            throws IllegalArgumentException,
                                   UnsupportedOperationException,
                                   FileAlreadyExistsException,
                                   IOException,
                                   SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
FileAlreadyExistsException
IOException
SecurityException
See Also:
Original JavaDoc

createDirectories

public static Path createDirectories(Path dir,
                                     FileAttribute<?>... attrs)
                              throws UnsupportedOperationException,
                                     FileAlreadyExistsException,
                                     IOException,
                                     SecurityException
Throws:
UnsupportedOperationException
FileAlreadyExistsException
IOException
SecurityException

createSymbolicLink

public static Path createSymbolicLink(Path link,
                                      Path target,
                                      FileAttribute<?>... attrs)
                               throws IllegalArgumentException,
                                      UnsupportedOperationException,
                                      FileAlreadyExistsException,
                                      IOException,
                                      SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
FileAlreadyExistsException
IOException
SecurityException
See Also:
Original JavaDoc

createLink

public static Path createLink(Path link,
                              Path existing)
                       throws IllegalArgumentException,
                              UnsupportedOperationException,
                              FileAlreadyExistsException,
                              IOException,
                              SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
FileAlreadyExistsException
IOException
SecurityException
See Also:
Original JavaDoc

delete

public static void delete(Path path)
                   throws IllegalArgumentException,
                          NoSuchFileException,
                          DirectoryNotEmptyException,
                          IOException,
                          SecurityException
Throws:
IllegalArgumentException
NoSuchFileException
DirectoryNotEmptyException
IOException
SecurityException
See Also:
Original JavaDoc

deleteIfExists

public static boolean deleteIfExists(Path path)
                              throws IllegalArgumentException,
                                     DirectoryNotEmptyException,
                                     IOException,
                                     SecurityException
Throws:
IllegalArgumentException
DirectoryNotEmptyException
IOException
SecurityException
See Also:
Original JavaDoc

createTempFile

public static Path createTempFile(String prefix,
                                  String suffix,
                                  FileAttribute<?>... attrs)
                           throws IllegalArgumentException,
                                  UnsupportedOperationException,
                                  IOException,
                                  SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
IOException
SecurityException

createTempFile

public static Path createTempFile(Path dir,
                                  String prefix,
                                  String suffix,
                                  FileAttribute<?>... attrs)
                           throws IllegalArgumentException,
                                  UnsupportedOperationException,
                                  IOException,
                                  SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
IOException
SecurityException

createTempDirectory

public static Path createTempDirectory(String prefix,
                                       FileAttribute<?>... attrs)
                                throws IllegalArgumentException,
                                       UnsupportedOperationException,
                                       IOException,
                                       SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
IOException
SecurityException

createTempDirectory

public static Path createTempDirectory(Path dir,
                                       String prefix,
                                       FileAttribute<?>... attrs)
                                throws IllegalArgumentException,
                                       UnsupportedOperationException,
                                       IOException,
                                       SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
IOException
SecurityException

copy

public static Path copy(Path source,
                        Path target,
                        CopyOption... options)
                 throws UnsupportedOperationException,
                        FileAlreadyExistsException,
                        DirectoryNotEmptyException,
                        IOException,
                        SecurityException
Throws:
UnsupportedOperationException
FileAlreadyExistsException
DirectoryNotEmptyException
IOException
SecurityException

move

public static Path move(Path source,
                        Path target,
                        CopyOption... options)
                 throws UnsupportedOperationException,
                        FileAlreadyExistsException,
                        DirectoryNotEmptyException,
                        AtomicMoveNotSupportedException,
                        IOException,
                        SecurityException
Throws:
UnsupportedOperationException
FileAlreadyExistsException
DirectoryNotEmptyException
AtomicMoveNotSupportedException
IOException
SecurityException

readSymbolicLink

public static Path readSymbolicLink(Path link)
                             throws IllegalArgumentException,
                                    UnsupportedOperationException,
                                    NotLinkException,
                                    IOException,
                                    SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
NotLinkException
IOException
SecurityException
See Also:
Original JavaDoc

getFileStore

public static FileStore getFileStore(Path path)
                              throws IllegalArgumentException,
                                     IOException,
                                     SecurityException
Throws:
IllegalArgumentException
IOException
SecurityException
See Also:
Original JavaDoc

probeContentType

public static String probeContentType(Path path)
                               throws UnsupportedOperationException,
                                      IOException,
                                      SecurityException
Throws:
UnsupportedOperationException
IOException
SecurityException

getFileAttributeView

public static <V extends FileAttributeView> V getFileAttributeView(Path path,
                                                                   Class<V> type,
                                                                   LinkOption... options)
                                                        throws IllegalArgumentException
Throws:
IllegalArgumentException
See Also:
Original JavaDoc

readAttributes

public static <A extends BasicFileAttributes> A readAttributes(Path path,
                                                               Class<A> type,
                                                               LinkOption... options)
                                                    throws IllegalArgumentException,
                                                           NoSuchFileException,
                                                           UnsupportedOperationException,
                                                           IOException,
                                                           SecurityException
Throws:
IllegalArgumentException
UnsupportedOperationException
IOException
SecurityException
NoSuchFileException
See Also:
Original JavaDoc

readAttributes

public static Map<String,Object> readAttributes(Path path,
                                                String attributes,
                                                LinkOption... options)
                                         throws UnsupportedOperationException,
                                                NoSuchFileException,
                                                IllegalArgumentException,
                                                IOException,
                                                SecurityException
Throws:
UnsupportedOperationException
IllegalArgumentException
IOException
SecurityException
NoSuchFileException
See Also:
Original JavaDoc

setAttribute

public static Path setAttribute(Path path,
                                String attribute,
                                Object value,
                                LinkOption... options)
                         throws UnsupportedOperationException,
                                IllegalArgumentException,
                                ClassCastException,
                                IOException,
                                SecurityException
Throws:
UnsupportedOperationException
IllegalArgumentException
ClassCastException
IOException
SecurityException
See Also:
Original JavaDoc

getAttribute

public static Object getAttribute(Path path,
                                  String attribute,
                                  LinkOption... options)
                           throws UnsupportedOperationException,
                                  IllegalArgumentException,
                                  IOException,
                                  SecurityException
Throws:
UnsupportedOperationException
IllegalArgumentException
IOException
SecurityException

getPosixFilePermissions

public static Set<PosixFilePermission> getPosixFilePermissions(Path path,
                                                               LinkOption... options)
                                                        throws UnsupportedOperationException,
                                                               IOException,
                                                               SecurityException
Throws:
UnsupportedOperationException
IOException
SecurityException

setPosixFilePermissions

public static Path setPosixFilePermissions(Path path,
                                           Set<PosixFilePermission> perms)
                                    throws UnsupportedOperationException,
                                           ClassCastException,
                                           IOException,
                                           SecurityException
Throws:
UnsupportedOperationException
ClassCastException
IOException
SecurityException

getOwner

public static UserPrincipal getOwner(Path path,
                                     LinkOption... options)
                              throws UnsupportedOperationException,
                                     IOException,
                                     SecurityException
Throws:
UnsupportedOperationException
IOException
SecurityException

setOwner

public static Path setOwner(Path path,
                            UserPrincipal owner)
                     throws UnsupportedOperationException,
                            IOException,
                            SecurityException
Throws:
UnsupportedOperationException
IOException
SecurityException

getLastModifiedTime

public static FileTime getLastModifiedTime(Path path,
                                           LinkOption... options)
                                    throws IllegalArgumentException,
                                           IOException,
                                           SecurityException
Throws:
IllegalArgumentException
IOException
SecurityException
See Also:
Original JavaDoc

setLastModifiedTime

public static Path setLastModifiedTime(Path path,
                                       FileTime time)
                                throws IOException,
                                       SecurityException
Throws:
IOException
SecurityException

size

public static long size(Path path)
                 throws IllegalArgumentException,
                        IOException,
                        SecurityException
Throws:
IllegalArgumentException
IOException
SecurityException
See Also:
Original JavaDoc

exists

public static boolean exists(Path path,
                             LinkOption... options)
                      throws IllegalArgumentException,
                             SecurityException
Throws:
IllegalArgumentException
SecurityException
See Also:
Original JavaDoc

notExists

public static boolean notExists(Path path,
                                LinkOption... options)
                         throws IllegalArgumentException,
                                SecurityException
Throws:
IllegalArgumentException
SecurityException
See Also:
Original JavaDoc

isSameFile

public static boolean isSameFile(Path path,
                                 Path path2)
                          throws IllegalArgumentException,
                                 IOException,
                                 SecurityException
Throws:
IllegalArgumentException
IOException
SecurityException
See Also:
Original JavaDoc

isHidden

public static boolean isHidden(Path path)
                        throws IllegalArgumentException,
                               IOException,
                               SecurityException
Throws:
IllegalArgumentException
IOException
SecurityException
See Also:
Original JavaDoc

isReadable

public static boolean isReadable(Path path)
                          throws IllegalArgumentException,
                                 SecurityException
Throws:
IllegalArgumentException
SecurityException
See Also:
Original JavaDoc

isWritable

public static boolean isWritable(Path path)
                          throws IllegalArgumentException,
                                 SecurityException
Throws:
IllegalArgumentException
SecurityException
See Also:
Original JavaDoc

isExecutable

public static boolean isExecutable(Path path)
                            throws IllegalArgumentException,
                                   SecurityException
Throws:
IllegalArgumentException
SecurityException
See Also:
Original JavaDoc

isSymbolicLink

public static boolean isSymbolicLink(Path path)
                              throws IllegalArgumentException,
                                     SecurityException
Throws:
IllegalArgumentException
SecurityException
See Also:
Original JavaDoc

isDirectory

public static boolean isDirectory(Path path,
                                  LinkOption... options)
                           throws IllegalArgumentException,
                                  SecurityException
Throws:
IllegalArgumentException
SecurityException
See Also:
Original JavaDoc

isRegularFile

public static boolean isRegularFile(Path path,
                                    LinkOption... options)
                             throws IllegalAccessError,
                                    SecurityException
Throws:
IllegalAccessError
SecurityException
See Also:
Original JavaDoc

walkFileTree

public static Path walkFileTree(Path start,
                                Set<FileVisitOption> options,
                                int maxDepth,
                                FileVisitor<Path> visitor)
                         throws IllegalArgumentException,
                                SecurityException,
                                IOException
Throws:
IllegalArgumentException
SecurityException
IOException

walkFileTree

public static Path walkFileTree(Path start,
                                FileVisitor<Path> visitor)
                         throws IllegalArgumentException,
                                IOException,
                                SecurityException
Throws:
IllegalArgumentException
IOException
SecurityException
See Also:
Original JavaDoc

newBufferedReader

public static BufferedReader newBufferedReader(Path path,
                                               Charset cs)
                                        throws IllegalArgumentException,
                                               NoSuchFileException,
                                               IOException,
                                               SecurityException
Throws:
IllegalArgumentException
NoSuchFileException
IOException
SecurityException
See Also:
Original JavaDoc

newBufferedWriter

public static BufferedWriter newBufferedWriter(Path path,
                                               Charset cs,
                                               OpenOption... options)
                                        throws IllegalArgumentException,
                                               IOException,
                                               UnsupportedOperationException,
                                               SecurityException
Throws:
IllegalArgumentException
IOException
UnsupportedOperationException
SecurityException
See Also:
Original JavaDoc

copy

public static long copy(InputStream in,
                        Path target,
                        CopyOption... options)
                 throws IOException,
                        FileAlreadyExistsException,
                        DirectoryNotEmptyException,
                        UnsupportedOperationException,
                        SecurityException
Throws:
IOException
FileAlreadyExistsException
DirectoryNotEmptyException
UnsupportedOperationException
SecurityException

copy

public static long copy(Path source,
                        OutputStream out)
                 throws IOException,
                        SecurityException
Throws:
IOException
SecurityException

readAllBytes

public static byte[] readAllBytes(Path path)
                           throws IOException,
                                  OutOfMemoryError,
                                  SecurityException
Throws:
IOException
OutOfMemoryError
SecurityException

readAllLines

public static List<String> readAllLines(Path path,
                                        Charset cs)
                                 throws IllegalArgumentException,
                                        NoSuchFileException,
                                        IOException,
                                        SecurityException
Throws:
IllegalArgumentException
NoSuchFileException
IOException
SecurityException
See Also:
Original JavaDoc

write

public static Path write(Path path,
                         byte[] bytes,
                         OpenOption... options)
                  throws IOException,
                         UnsupportedOperationException,
                         SecurityException
Throws:
IOException
UnsupportedOperationException
SecurityException

write

public static Path write(Path path,
                         Iterable<? extends CharSequence> lines,
                         Charset cs,
                         OpenOption... options)
                  throws IllegalArgumentException,
                         IOException,
                         UnsupportedOperationException,
                         SecurityException
Throws:
IllegalArgumentException
IOException
UnsupportedOperationException
SecurityException
See Also:
Original JavaDoc

KIE NIO.2 :: API 6.0.0.Beta3

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.