public class FileLocation extends java.lang.Object implements Location
| Modifier and Type | Field and Description |
|---|---|
private java.nio.channels.FileChannel |
channel |
private java.io.File |
file |
private java.lang.String |
specification |
private java.io.FileInputStream |
stream |
| Modifier | Constructor and Description |
|---|---|
|
FileLocation(java.io.File file,
java.lang.String specification) |
protected |
FileLocation(java.lang.String specification) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the location.
|
java.io.File |
getFile() |
java.io.InputStream |
getInputStream() |
java.lang.String |
getSpecification() |
protected void |
initFile()
initialize file.
|
void |
open()
open the location.
|
int |
read(byte[] buffer) |
int |
read(java.nio.ByteBuffer buffer) |
protected void |
setFile(java.io.File file) |
protected java.io.File |
unsafeGetFile() |
private java.io.File file
private java.nio.channels.FileChannel channel
private final java.lang.String specification
private java.io.FileInputStream stream
public FileLocation(java.io.File file,
java.lang.String specification)
file - Filespecification - spec.protected FileLocation(java.lang.String specification)
specification - spec.public java.io.File getFile()
throws java.io.IOException
protected java.io.File unsafeGetFile()
Fileprotected void initFile()
throws java.io.IOException
java.io.IOException - in case error.protected void setFile(java.io.File file)
file - Filepublic java.lang.String getSpecification()
getSpecification in interface Locationpublic void open()
throws java.io.IOException
public int read(java.nio.ByteBuffer buffer)
throws java.io.IOException
public int read(byte[] buffer)
throws java.io.IOException
public java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in interface Locationjava.io.IOException - in case of an error.