Package org.arakhne.afc.io.dbase.attr
Class DBaseFileAttributePool
- java.lang.Object
-
- org.arakhne.afc.io.dbase.attr.DBaseFileAttributePool
-
public final class DBaseFileAttributePool extends Object
This class provides a pool of attributes obtained from a DBase file and that could be used by dedicated attribute providers.This class permits to syndicate the access to a single dBase file by several attribute provider, assuming that an attribute provider accesses only one record of the dBase file.
This class uses a soft-referenced
DBaseFileReaderinstance.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:52
- Author:
- Stéphane GALLAND
- See Also:
DBaseFileAttributeProvider,DBaseFileAttributeProvider- Maven Group Id:
- org.arakhne.afc.advanced
- Maven Artifact Id:
- dbasefile
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Close all opened accessors.voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.(package private) DBaseFileAttributeAccessorgetAccessor(int recordNumber)Replies the attribute accessor associated to the specified record number.Collection<String>getAllAttributeNames(int recordNumber)Replies the names of all the attributes that corresponds to the specified record number.intgetAttributeCount()Replies the count of attributes.static DBaseFileAttributeCollectiongetCollection(File dbaseFile, int recordNumber)Get an attribute container that corresponds to the specified file.static DBaseFileAttributeCollectiongetCollection(String resource, int recordNumber)Get an attribute container that corresponds to the specified filestatic DBaseFileAttributeCollectiongetCollection(URI dbaseFile, int recordNumber)Get an attribute container that corresponds to the specified file.static DBaseFileAttributeCollectiongetCollection(URL dbaseFile, int recordNumber)Get an attribute container that corresponds to the specified file.static DBaseFileAttributeProvidergetContainer(URL dbaseFile, int recordNumber)Get an attribute container that corresponds to the specified file.(package private) static DBaseFileAttributePoolgetPool(File dbaseFile)Get the attribute pool that corresponds to the specified file.(package private) static DBaseFileAttributePoolgetPool(String resource)Get the attribute pool that corresponds to the specified resource.(package private) static DBaseFileAttributePoolgetPool(URI dbaseFile)Get the attribute pool that corresponds to the specified file.(package private) static DBaseFileAttributePoolgetPool(URL dbaseFile)Get the attribute pool that corresponds to the specified file.static DBaseFileAttributeProvidergetProvider(File dbaseFile, int recordNumber)Get an attribute container that corresponds to the specified file.static DBaseFileAttributeProvidergetProvider(String resource, int recordNumber)Get an attribute container that corresponds to the specified filestatic DBaseFileAttributeProvidergetProvider(URI dbaseFile, int recordNumber)Get an attribute container that corresponds to the specified file.ObjectgetRawValue(int recordNumber, String name, OutputParameter<AttributeType> type)Replies the raw value that corresponds to the specified attribute name for the given record.protected DBaseFileReadergetReader()Replies the reader.URLgetResource()Replies the resource used by this pool.
-
-
-
Method Detail
-
getPool
static DBaseFileAttributePool getPool(URL dbaseFile)
Get the attribute pool that corresponds to the specified file.- Parameters:
dbaseFile- is the file from which the attributes could be extracted.- Returns:
- the pool associated to the given file.
-
getPool
static DBaseFileAttributePool getPool(URI dbaseFile)
Get the attribute pool that corresponds to the specified file.- Parameters:
dbaseFile- is the file from which the attributes could be extracted.- Returns:
- the pool associated to the given file.
-
getPool
static DBaseFileAttributePool getPool(File dbaseFile)
Get the attribute pool that corresponds to the specified file.- Parameters:
dbaseFile- is the file from which the attributes could be extracted.- Returns:
- the pool associated to the given file.
-
getPool
static DBaseFileAttributePool getPool(String resource)
Get the attribute pool that corresponds to the specified resource.The resource should be located according to the
Class.getResource(String)orClass.getResourceAsStream(String)functions.- Parameters:
resource- is the resource from which the attributes could be extracted.- Returns:
- the pool associated to the given resource.
-
getContainer
@Pure public static DBaseFileAttributeProvider getContainer(URL dbaseFile, int recordNumber)
Get an attribute container that corresponds to the specified file.- Parameters:
dbaseFile- is the file to readrecordNumber- is the index of the record inside the file (0..size-1).- Returns:
- a container or
nullon error
-
getProvider
@Pure public static DBaseFileAttributeProvider getProvider(URI dbaseFile, int recordNumber)
Get an attribute container that corresponds to the specified file.- Parameters:
dbaseFile- is the file to readrecordNumber- is the index of the record inside the file (0..size-1).- Returns:
- a container or
nullon error
-
getProvider
@Pure public static DBaseFileAttributeProvider getProvider(File dbaseFile, int recordNumber)
Get an attribute container that corresponds to the specified file.- Parameters:
dbaseFile- is the file to readrecordNumber- is the index of the record inside the file (0..size-1).- Returns:
- a container or
nullon error
-
getProvider
@Pure public static DBaseFileAttributeProvider getProvider(String resource, int recordNumber)
Get an attribute container that corresponds to the specified fileThe resource should be located according to the
Class.getResource(String)orClass.getResourceAsStream(String)functions.- Parameters:
resource- is the resource to readrecordNumber- is the index of the record inside the file (0..size-1).- Returns:
- a container or
nullon error
-
getCollection
@Pure public static DBaseFileAttributeCollection getCollection(URL dbaseFile, int recordNumber)
Get an attribute container that corresponds to the specified file.- Parameters:
dbaseFile- is the file to readrecordNumber- is the index of the record inside the file (0..size-1).- Returns:
- a container or
nullon error
-
getCollection
@Pure public static DBaseFileAttributeCollection getCollection(URI dbaseFile, int recordNumber)
Get an attribute container that corresponds to the specified file.- Parameters:
dbaseFile- is the file to readrecordNumber- is the index of the record inside the file (0..size-1).- Returns:
- a container or
nullon error
-
getCollection
@Pure public static DBaseFileAttributeCollection getCollection(File dbaseFile, int recordNumber)
Get an attribute container that corresponds to the specified file.- Parameters:
dbaseFile- is the file to readrecordNumber- is the index of the record inside the file (0..size-1).- Returns:
- a container or
nullon error
-
getCollection
@Pure public static DBaseFileAttributeCollection getCollection(String resource, int recordNumber)
Get an attribute container that corresponds to the specified fileThe resource should be located according to the
Class.getResource(String)orClass.getResourceAsStream(String)functions.- Parameters:
resource- is the resource to readrecordNumber- is the index of the record inside the file (0..size-1).- Returns:
- a container or
nullon error
-
close
public void close() throws IOExceptionClose all opened accessors.- Throws:
IOException- in case of error.
-
finalize
@Deprecated(since="17.0", forRemoval=true) public void finalize() throws Throwable
Deprecated, for removal: This API element is subject to removal in a future version.
-
getResource
@Pure public URL getResource()
Replies the resource used by this pool.- Returns:
- the resource used by this pool.
-
getReader
@Pure protected DBaseFileReader getReader() throws IOException
Replies the reader.- Returns:
- the reader.
- Throws:
IOException- in case of error.
-
getAllAttributeNames
@Pure public Collection<String> getAllAttributeNames(int recordNumber)
Replies the names of all the attributes that corresponds to the specified record number.The parameter is not used because, in a dBase file, all the record have the same attribute names.
- Parameters:
recordNumber- the number of the record.- Returns:
- the collection of attribute names
-
getAttributeCount
@Pure public int getAttributeCount()
Replies the count of attributes.- Returns:
- the count of attributes
-
getRawValue
@Pure public Object getRawValue(int recordNumber, String name, OutputParameter<AttributeType> type) throws AttributeException
Replies the raw value that corresponds to the specified attribute name for the given record.- Parameters:
recordNumber- is the index of the record to read (0..recordCount-1).name- is the name of the attribute value to replies.type- is the type of the replied value. Tis attribute will be set by this function.- Returns:
- the value extracted from the pool.
- Throws:
AttributeException- if an attribute cannot be read.
-
getAccessor
@Pure DBaseFileAttributeAccessor getAccessor(int recordNumber)
Replies the attribute accessor associated to the specified record number.- Parameters:
recordNumber- is the number of the record for which an accessor may be obtainable.- Returns:
- the accessor to the record at the given position.
-
-