com.univocity.api.io
Class FileProvider

java.lang.Object
  extended by com.univocity.api.io.FileProvider

public final class FileProvider
extends Object

A FileProvider validates and stores the minimum information required by uniVocity to locate and manipulate files. System properties can be used as part of the file name, such as {user.home}.

Author:
uniVocity Software Pty Ltd - dev@univocity.com

Constructor Summary
FileProvider(File file)
          Creates a provider for the file to be read/written using the default system encoding.
FileProvider(File file, Charset encoding)
          Creates a provider for the file to be read/written using a given encoding
FileProvider(File file, String encoding)
          Creates a provider for the file to be read/written using a given encoding
FileProvider(String file)
          Creates a provider for the file, represented by a path, to be read/written using the default system encoding.
FileProvider(String filePath, Charset encoding)
          Creates a provider for the file, represented by a path, to be read/written using the default system encoding.
FileProvider(String file, String encoding)
          Creates a provider for the file, represented by a path, to be read/written using the default system encoding.
 
Method Summary
 boolean equals(Object o)
           
 Charset getEncoding()
          Returns the encoding used to manipulate the provided file.
 File getFile()
          Returns the File instance given in the constructor of this class, or null if a path to a resource is being used.
 String getFilePath()
          Returns the resource path given in the constructor of this class, or null if a File is being used.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileProvider

public FileProvider(File file)
Creates a provider for the file to be read/written using the default system encoding.

Parameters:
file - the File

FileProvider

public FileProvider(File file,
                    String encoding)
Creates a provider for the file to be read/written using a given encoding

Parameters:
file - the File to be used.
encoding - the name of the encoding that must be used to read from/write to the given file.

FileProvider

public FileProvider(File file,
                    Charset encoding)
Creates a provider for the file to be read/written using a given encoding

Parameters:
file - the File to be used.
encoding - the encoding that must be used to read from/write to the given file.

FileProvider

public FileProvider(String file)
Creates a provider for the file, represented by a path, to be read/written using the default system encoding. The path can contain system variables enclosed within { and } (e.g. {user.home}/myapp/log").

Parameters:
file - the path to a file. It can either be the path to a file in the file system or a resource in the classpath.

FileProvider

public FileProvider(String file,
                    String encoding)
Creates a provider for the file, represented by a path, to be read/written using the default system encoding. The path can contain system variables enclosed within { and } (e.g. {user.home}/myapp/log").

Parameters:
file - the path to a file. It can either be the path to a file in the file system or a resource in the classpath.
encoding - the name of the encoding that must be used to read from/write to the given file.

FileProvider

public FileProvider(String filePath,
                    Charset encoding)
Creates a provider for the file, represented by a path, to be read/written using the default system encoding. The path can contain system variables enclosed within { and } (e.g. {user.home}/myapp/log").

Parameters:
filePath - the path to a file. It can either be the path to a file in the file system or a resource in the classpath.
encoding - the encoding that must be used to read from/write to the given file.
Method Detail

getFile

public final File getFile()
Returns the File instance given in the constructor of this class, or null if a path to a resource is being used.

Returns:
the File to be loaded by uniVocity, or null if a resource path should be used instead.

getEncoding

public final Charset getEncoding()
Returns the encoding used to manipulate the provided file.

Returns:
encoding used to manipulate the provided file.

getFilePath

public final String getFilePath()
Returns the resource path given in the constructor of this class, or null if a File is being used.

Returns:
the path to a resource to be loaded by uniVocity, or null if a File should be used instead.

toString

public final String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.