Kie Commons I/O 6.0.0.CR5

org.kie.commons.io.impl
Class AbstractIOService

java.lang.Object
  extended by org.kie.commons.io.impl.AbstractIOService
All Implemented Interfaces:
IOService
Direct Known Subclasses:
IOServiceDotFileImpl, IOServiceNio2WrapperImpl

public abstract class AbstractIOService
extends Object
implements IOService


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.kie.commons.io.IOService
IOService.NewFileSystemListener
 
Field Summary
static FileSystemType DEFAULT_FS_TYPE
           
protected  Map<FileSystemType,List<FileSystem>> fileSystems
           
protected  IOWatchService ioWatchService
           
protected  boolean isDisposed
           
protected  org.kie.commons.lock.LockService lockService
           
protected  IOService.NewFileSystemListener newFileSystemListener
           
protected static Charset UTF_8
           
 
Fields inherited from interface org.kie.commons.io.IOService
EMPTY_OPTIONS
 
Constructor Summary
AbstractIOService()
           
AbstractIOService(IOWatchService watchService)
           
AbstractIOService(org.kie.commons.lock.LockService lockService, IOWatchService watchService)
           
 
Method Summary
protected abstract  Set<? extends OpenOption> buildOptions(Set<? extends OpenOption> options, OpenOption... other)
           
 org.kie.commons.java.nio.file.attribute.FileAttribute<?>[] convert(Map<String,?> attrs)
           
 long copy(InputStream in, Path target, CopyOption... options)
           
 long copy(Path source, OutputStream out)
           
 Path createDirectories(Path dir, Map<String,?> attrs)
           
 Path createDirectory(Path dir, Map<String,?> attrs)
           
 Path createFile(Path path, org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           
 Path createTempDirectory(Path dir, String prefix, org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           
 Path createTempDirectory(String prefix, org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           
 Path createTempFile(Path dir, String prefix, String suffix, org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           
 Path createTempFile(String prefix, String suffix, org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           
 void dispose()
           
 void endBatch(Option... options)
           
 boolean exists(Path path)
           
 Path get(String first, String... more)
           
 Path get(URI uri)
           
 FileSystem getFileSystem(URI uri)
           
 Iterable<FileSystem> getFileSystems()
           
 List<FileSystem> getFileSystems(FileSystemType type)
           
 org.kie.commons.java.nio.file.attribute.FileTime getLastModifiedTime(Path path)
           
 boolean isSameFile(Path path, Path path2)
           
 BufferedReader newBufferedReader(Path path, Charset cs)
           
 BufferedWriter newBufferedWriter(Path path, Charset cs, OpenOption... options)
           
 org.kie.commons.java.nio.channels.SeekableByteChannel newByteChannel(Path path, OpenOption... options)
           
 DirectoryStream<Path> newDirectoryStream(Path dir)
           
 DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<Path> filter)
           
 FileSystem newFileSystem(URI uri, Map<String,?> env)
           
 FileSystem newFileSystem(URI uri, Map<String,?> env, FileSystemType type)
           
 InputStream newInputStream(Path path, OpenOption... options)
           
 OutputStream newOutputStream(Path path, OpenOption... options)
           
 boolean notExists(Path path)
           
 void onNewFileSystem(IOService.NewFileSystemListener listener)
           
 byte[] readAllBytes(Path path)
           
 List<String> readAllLines(Path path)
           
 List<String> readAllLines(Path path, Charset cs)
           
 String readAllString(Path path)
           
 String readAllString(Path path, Charset cs)
           
 Map<String,Object> readAttributes(Path path)
           
 Path setAttribute(Path path, String attribute, Object value)
           
 Path setAttributes(Path path, Map<String,Object> attrs)
           
 long size(Path path)
           
 void startBatch(Option... options)
           
 Path write(Path path, byte[] bytes, Map<String,?> attrs, OpenOption... options)
           
 Path write(Path path, byte[] bytes, OpenOption... options)
           
 Path write(Path path, byte[] bytes, Set<? extends OpenOption> options, org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           
 Path write(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options)
           
 Path write(Path path, String content, Charset cs, Map<String,?> attrs, OpenOption... options)
           
 Path write(Path path, String content, Charset cs, OpenOption... options)
           
 Path write(Path path, String content, Charset cs, Set<? extends OpenOption> options, org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           
 Path write(Path path, String content, Map<String,?> attrs, OpenOption... options)
           
 Path write(Path path, String content, OpenOption... options)
           
 Path write(Path path, String content, Set<? extends OpenOption> options, org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kie.commons.io.IOService
copy, createDirectories, createDirectory, delete, deleteIfExists, getAttribute, getFileAttributeView, move, newByteChannel, readAttributes, setAttributes
 

Field Detail

UTF_8

protected static final Charset UTF_8

DEFAULT_FS_TYPE

public static final FileSystemType DEFAULT_FS_TYPE

lockService

protected final org.kie.commons.lock.LockService lockService

ioWatchService

protected final IOWatchService ioWatchService

fileSystems

protected final Map<FileSystemType,List<FileSystem>> fileSystems

newFileSystemListener

protected IOService.NewFileSystemListener newFileSystemListener

isDisposed

protected boolean isDisposed
Constructor Detail

AbstractIOService

public AbstractIOService()

AbstractIOService

public AbstractIOService(IOWatchService watchService)

AbstractIOService

public AbstractIOService(org.kie.commons.lock.LockService lockService,
                         IOWatchService watchService)
Method Detail

startBatch

public void startBatch(Option... options)
Specified by:
startBatch in interface IOService

endBatch

public void endBatch(Option... options)
Specified by:
endBatch in interface IOService

get

public Path get(String first,
                String... more)
         throws IllegalArgumentException
Specified by:
get in interface IOService
Throws:
IllegalArgumentException

get

public Path get(URI uri)
         throws IllegalArgumentException,
                FileSystemNotFoundException,
                SecurityException
Specified by:
get in interface IOService
Throws:
IllegalArgumentException
FileSystemNotFoundException
SecurityException

getFileSystems

public Iterable<FileSystem> getFileSystems()
Specified by:
getFileSystems in interface IOService

getFileSystems

public List<FileSystem> getFileSystems(FileSystemType type)
Specified by:
getFileSystems in interface IOService

getFileSystem

public FileSystem getFileSystem(URI uri)
Specified by:
getFileSystem in interface IOService

newFileSystem

public FileSystem newFileSystem(URI uri,
                                Map<String,?> env)
                         throws IllegalArgumentException,
                                FileSystemAlreadyExistsException,
                                ProviderNotFoundException,
                                org.kie.commons.java.nio.IOException,
                                SecurityException
Specified by:
newFileSystem in interface IOService
Throws:
IllegalArgumentException
FileSystemAlreadyExistsException
ProviderNotFoundException
org.kie.commons.java.nio.IOException
SecurityException

newFileSystem

public FileSystem newFileSystem(URI uri,
                                Map<String,?> env,
                                FileSystemType type)
                         throws IllegalArgumentException,
                                FileSystemAlreadyExistsException,
                                ProviderNotFoundException,
                                org.kie.commons.java.nio.IOException,
                                SecurityException
Specified by:
newFileSystem in interface IOService
Throws:
IllegalArgumentException
FileSystemAlreadyExistsException
ProviderNotFoundException
org.kie.commons.java.nio.IOException
SecurityException

onNewFileSystem

public void onNewFileSystem(IOService.NewFileSystemListener listener)
Specified by:
onNewFileSystem in interface IOService

newInputStream

public InputStream newInputStream(Path path,
                                  OpenOption... options)
                           throws IllegalArgumentException,
                                  NoSuchFileException,
                                  UnsupportedOperationException,
                                  org.kie.commons.java.nio.IOException,
                                  SecurityException
Specified by:
newInputStream in interface IOService
Throws:
IllegalArgumentException
NoSuchFileException
UnsupportedOperationException
org.kie.commons.java.nio.IOException
SecurityException

newDirectoryStream

public DirectoryStream<Path> newDirectoryStream(Path dir)
                                         throws IllegalArgumentException,
                                                NotDirectoryException,
                                                org.kie.commons.java.nio.IOException,
                                                SecurityException
Specified by:
newDirectoryStream in interface IOService
Throws:
IllegalArgumentException
NotDirectoryException
org.kie.commons.java.nio.IOException
SecurityException

newDirectoryStream

public DirectoryStream<Path> newDirectoryStream(Path dir,
                                                DirectoryStream.Filter<Path> filter)
                                         throws IllegalArgumentException,
                                                NotDirectoryException,
                                                org.kie.commons.java.nio.IOException,
                                                SecurityException
Specified by:
newDirectoryStream in interface IOService
Throws:
IllegalArgumentException
NotDirectoryException
org.kie.commons.java.nio.IOException
SecurityException

newOutputStream

public OutputStream newOutputStream(Path path,
                                    OpenOption... options)
                             throws IllegalArgumentException,
                                    UnsupportedOperationException,
                                    org.kie.commons.java.nio.IOException,
                                    SecurityException
Specified by:
newOutputStream in interface IOService
Throws:
IllegalArgumentException
UnsupportedOperationException
org.kie.commons.java.nio.IOException
SecurityException

newByteChannel

public org.kie.commons.java.nio.channels.SeekableByteChannel newByteChannel(Path path,
                                                                            OpenOption... options)
                                                                     throws IllegalArgumentException,
                                                                            UnsupportedOperationException,
                                                                            FileAlreadyExistsException,
                                                                            org.kie.commons.java.nio.IOException,
                                                                            SecurityException
Specified by:
newByteChannel in interface IOService
Throws:
IllegalArgumentException
UnsupportedOperationException
FileAlreadyExistsException
org.kie.commons.java.nio.IOException
SecurityException

createDirectory

public Path createDirectory(Path dir,
                            Map<String,?> attrs)
                     throws IllegalArgumentException,
                            UnsupportedOperationException,
                            FileAlreadyExistsException,
                            org.kie.commons.java.nio.IOException,
                            SecurityException
Specified by:
createDirectory in interface IOService
Throws:
IllegalArgumentException
UnsupportedOperationException
FileAlreadyExistsException
org.kie.commons.java.nio.IOException
SecurityException

createDirectories

public Path createDirectories(Path dir,
                              Map<String,?> attrs)
                       throws UnsupportedOperationException,
                              FileAlreadyExistsException,
                              org.kie.commons.java.nio.IOException,
                              SecurityException
Specified by:
createDirectories in interface IOService
Throws:
UnsupportedOperationException
FileAlreadyExistsException
org.kie.commons.java.nio.IOException
SecurityException

createTempFile

public Path createTempFile(String prefix,
                           String suffix,
                           org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
                    throws IllegalArgumentException,
                           UnsupportedOperationException,
                           org.kie.commons.java.nio.IOException,
                           SecurityException
Specified by:
createTempFile in interface IOService
Throws:
IllegalArgumentException
UnsupportedOperationException
org.kie.commons.java.nio.IOException
SecurityException

createTempFile

public Path createTempFile(Path dir,
                           String prefix,
                           String suffix,
                           org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
                    throws IllegalArgumentException,
                           UnsupportedOperationException,
                           org.kie.commons.java.nio.IOException,
                           SecurityException
Specified by:
createTempFile in interface IOService
Throws:
IllegalArgumentException
UnsupportedOperationException
org.kie.commons.java.nio.IOException
SecurityException

createTempDirectory

public Path createTempDirectory(String prefix,
                                org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
                         throws IllegalArgumentException,
                                UnsupportedOperationException,
                                org.kie.commons.java.nio.IOException,
                                SecurityException
Specified by:
createTempDirectory in interface IOService
Throws:
IllegalArgumentException
UnsupportedOperationException
org.kie.commons.java.nio.IOException
SecurityException

createTempDirectory

public Path createTempDirectory(Path dir,
                                String prefix,
                                org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
                         throws IllegalArgumentException,
                                UnsupportedOperationException,
                                org.kie.commons.java.nio.IOException,
                                SecurityException
Specified by:
createTempDirectory in interface IOService
Throws:
IllegalArgumentException
UnsupportedOperationException
org.kie.commons.java.nio.IOException
SecurityException

getLastModifiedTime

public org.kie.commons.java.nio.file.attribute.FileTime getLastModifiedTime(Path path)
                                                                     throws IllegalArgumentException,
                                                                            org.kie.commons.java.nio.IOException,
                                                                            SecurityException
Specified by:
getLastModifiedTime in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
SecurityException

readAttributes

public Map<String,Object> readAttributes(Path path)
                                  throws UnsupportedOperationException,
                                         NoSuchFileException,
                                         IllegalArgumentException,
                                         org.kie.commons.java.nio.IOException,
                                         SecurityException
Specified by:
readAttributes in interface IOService
Throws:
UnsupportedOperationException
NoSuchFileException
IllegalArgumentException
org.kie.commons.java.nio.IOException
SecurityException

setAttribute

public Path setAttribute(Path path,
                         String attribute,
                         Object value)
                  throws UnsupportedOperationException,
                         IllegalArgumentException,
                         ClassCastException,
                         org.kie.commons.java.nio.IOException,
                         SecurityException
Specified by:
setAttribute in interface IOService
Throws:
UnsupportedOperationException
IllegalArgumentException
ClassCastException
org.kie.commons.java.nio.IOException
SecurityException

setAttributes

public Path setAttributes(Path path,
                          Map<String,Object> attrs)
                   throws UnsupportedOperationException,
                          IllegalArgumentException,
                          ClassCastException,
                          org.kie.commons.java.nio.IOException,
                          SecurityException
Specified by:
setAttributes in interface IOService
Throws:
UnsupportedOperationException
IllegalArgumentException
ClassCastException
org.kie.commons.java.nio.IOException
SecurityException

size

public long size(Path path)
          throws IllegalArgumentException,
                 org.kie.commons.java.nio.IOException,
                 SecurityException
Specified by:
size in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
SecurityException

exists

public boolean exists(Path path)
               throws IllegalArgumentException,
                      SecurityException
Specified by:
exists in interface IOService
Throws:
IllegalArgumentException
SecurityException

notExists

public boolean notExists(Path path)
                  throws IllegalArgumentException,
                         SecurityException
Specified by:
notExists in interface IOService
Throws:
IllegalArgumentException
SecurityException

isSameFile

public boolean isSameFile(Path path,
                          Path path2)
                   throws IllegalArgumentException,
                          org.kie.commons.java.nio.IOException,
                          SecurityException
Specified by:
isSameFile in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
SecurityException

createFile

public Path createFile(Path path,
                       org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
                throws IllegalArgumentException,
                       UnsupportedOperationException,
                       FileAlreadyExistsException,
                       org.kie.commons.java.nio.IOException,
                       SecurityException
Specified by:
createFile in interface IOService
Throws:
IllegalArgumentException
UnsupportedOperationException
FileAlreadyExistsException
org.kie.commons.java.nio.IOException
SecurityException

newBufferedReader

public BufferedReader newBufferedReader(Path path,
                                        Charset cs)
                                 throws IllegalArgumentException,
                                        NoSuchFileException,
                                        org.kie.commons.java.nio.IOException,
                                        SecurityException
Specified by:
newBufferedReader in interface IOService
Throws:
IllegalArgumentException
NoSuchFileException
org.kie.commons.java.nio.IOException
SecurityException

copy

public long copy(Path source,
                 OutputStream out)
          throws org.kie.commons.java.nio.IOException,
                 SecurityException
Specified by:
copy in interface IOService
Throws:
org.kie.commons.java.nio.IOException
SecurityException

readAllBytes

public byte[] readAllBytes(Path path)
                    throws org.kie.commons.java.nio.IOException,
                           OutOfMemoryError,
                           SecurityException
Specified by:
readAllBytes in interface IOService
Throws:
org.kie.commons.java.nio.IOException
OutOfMemoryError
SecurityException

readAllLines

public List<String> readAllLines(Path path)
                          throws IllegalArgumentException,
                                 NoSuchFileException,
                                 org.kie.commons.java.nio.IOException,
                                 SecurityException
Specified by:
readAllLines in interface IOService
Throws:
IllegalArgumentException
NoSuchFileException
org.kie.commons.java.nio.IOException
SecurityException

readAllLines

public List<String> readAllLines(Path path,
                                 Charset cs)
                          throws IllegalArgumentException,
                                 NoSuchFileException,
                                 org.kie.commons.java.nio.IOException,
                                 SecurityException
Specified by:
readAllLines in interface IOService
Throws:
IllegalArgumentException
NoSuchFileException
org.kie.commons.java.nio.IOException
SecurityException

readAllString

public String readAllString(Path path,
                            Charset cs)
                     throws IllegalArgumentException,
                            NoSuchFileException,
                            org.kie.commons.java.nio.IOException
Specified by:
readAllString in interface IOService
Throws:
IllegalArgumentException
NoSuchFileException
org.kie.commons.java.nio.IOException

readAllString

public String readAllString(Path path)
                     throws IllegalArgumentException,
                            NoSuchFileException,
                            org.kie.commons.java.nio.IOException
Specified by:
readAllString in interface IOService
Throws:
IllegalArgumentException
NoSuchFileException
org.kie.commons.java.nio.IOException

newBufferedWriter

public BufferedWriter newBufferedWriter(Path path,
                                        Charset cs,
                                        OpenOption... options)
                                 throws IllegalArgumentException,
                                        org.kie.commons.java.nio.IOException,
                                        UnsupportedOperationException,
                                        SecurityException
Specified by:
newBufferedWriter in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
UnsupportedOperationException
SecurityException

copy

public long copy(InputStream in,
                 Path target,
                 CopyOption... options)
          throws org.kie.commons.java.nio.IOException,
                 FileAlreadyExistsException,
                 DirectoryNotEmptyException,
                 UnsupportedOperationException,
                 SecurityException
Specified by:
copy in interface IOService
Throws:
org.kie.commons.java.nio.IOException
FileAlreadyExistsException
DirectoryNotEmptyException
UnsupportedOperationException
SecurityException

write

public Path write(Path path,
                  byte[] bytes,
                  OpenOption... options)
           throws org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException,
                  SecurityException
Specified by:
write in interface IOService
Throws:
org.kie.commons.java.nio.IOException
UnsupportedOperationException
SecurityException

write

public Path write(Path path,
                  Iterable<? extends CharSequence> lines,
                  Charset cs,
                  OpenOption... options)
           throws IllegalArgumentException,
                  org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException,
                  SecurityException
Specified by:
write in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
UnsupportedOperationException
SecurityException

write

public Path write(Path path,
                  String content,
                  Charset cs,
                  OpenOption... options)
           throws IllegalArgumentException,
                  org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException
Specified by:
write in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
UnsupportedOperationException

write

public Path write(Path path,
                  String content,
                  OpenOption... options)
           throws IllegalArgumentException,
                  org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException
Specified by:
write in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
UnsupportedOperationException

write

public Path write(Path path,
                  String content,
                  Map<String,?> attrs,
                  OpenOption... options)
           throws IllegalArgumentException,
                  org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException
Specified by:
write in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
UnsupportedOperationException

write

public Path write(Path path,
                  String content,
                  Charset cs,
                  Map<String,?> attrs,
                  OpenOption... options)
           throws IllegalArgumentException,
                  org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException
Specified by:
write in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
UnsupportedOperationException

dispose

public void dispose()
Specified by:
dispose in interface IOService

convert

public org.kie.commons.java.nio.file.attribute.FileAttribute<?>[] convert(Map<String,?> attrs)
Specified by:
convert in interface IOService

write

public Path write(Path path,
                  byte[] bytes,
                  Map<String,?> attrs,
                  OpenOption... options)
           throws org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException,
                  SecurityException
Specified by:
write in interface IOService
Throws:
org.kie.commons.java.nio.IOException
UnsupportedOperationException
SecurityException

write

public Path write(Path path,
                  String content,
                  Set<? extends OpenOption> options,
                  org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           throws IllegalArgumentException,
                  org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException
Specified by:
write in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
UnsupportedOperationException

write

public Path write(Path path,
                  String content,
                  Charset cs,
                  Set<? extends OpenOption> options,
                  org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           throws IllegalArgumentException,
                  org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException
Specified by:
write in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
UnsupportedOperationException

write

public Path write(Path path,
                  byte[] bytes,
                  Set<? extends OpenOption> options,
                  org.kie.commons.java.nio.file.attribute.FileAttribute<?>... attrs)
           throws IllegalArgumentException,
                  org.kie.commons.java.nio.IOException,
                  UnsupportedOperationException
Specified by:
write in interface IOService
Throws:
IllegalArgumentException
org.kie.commons.java.nio.IOException
UnsupportedOperationException

buildOptions

protected abstract Set<? extends OpenOption> buildOptions(Set<? extends OpenOption> options,
                                                          OpenOption... other)

Kie Commons I/O 6.0.0.CR5

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