Top Description Fields Constructors Methods
org.apache.derby.impl.jdbc

pack-priv Class LOBFile

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.jdbc.EncryptedLOBFile
Imports
java.io.FileNotFoundException, .IOException, org.apache.derby.shared.common.error.StandardException, org.apache.derby.io.StorageFile, .StorageRandomAccessFile

LOBFile is a wrapper over StorageRandomAccessFile. The purpose of this class is to let the user of this class access StorageRandomAccessFile in plain and in encrypted for without having to change code.

Field Summary

Modifier and TypeField and Description
private final StorageRandomAccessFile
randomAccessFile

An object giving random access to storageFile.

private final StorageFile
storageFile

The temporary file where the contents of the LOB should be stored.

Constructor Summary

AccessConstructor and Description
pack-priv
LOBFile(StorageFile
StorageFile object for which the file will be created
lobFile
)

Constructs LOBFile.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
close()

Closes the file.

pack-priv long

Returns:

file pointer
getFilePointer
()

Returns the current position of the file pointer.

pack-priv StorageFile

Returns:

a StorageFile instance
getStorageFile
()

Get the StorageFile which represents the file where the contents of the LOB are stored.

pack-priv long

Returns:

length of the file
length
()

Returns length of the file.

pack-priv int

Returns:

number of bytes read
read
(byte[]
buffer
buff
,
int
starting position of buffer
off
,
int
number of bytes
len
)

Reads len number of bytes from the file starting from off position in the buffer.

pack-priv int

Returns:

byte
readByte
()

Reads one byte from file.

pack-priv void
seek(long
new position
pos
)

Sets the file pointer to a given position.

pack-priv void
setLength(long
new size
size
)

Sets the file length to a given size.

pack-priv void
write(int
int value of the byte
b
)

Writes one bytes into the file.

pack-priv void
write(byte[]
byte array containing bytes to write into the file
b
,
int
starting position of segment
off
,
int
number of bytes to be written
len
)

Writes a segment of bytes into the file.

pack-priv void
write(byte[]
buffer to write
buf
)

Writes a buffer completely into the file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

randomAccessFileback to summary
private final StorageRandomAccessFile randomAccessFile

An object giving random access to storageFile.

storageFileback to summary
private final StorageFile storageFile

The temporary file where the contents of the LOB should be stored.

Constructor Detail

LOBFileback to summary
pack-priv LOBFile(StorageFile lobFile) throws FileNotFoundException

Constructs LOBFile.

Parameters
lobFile:StorageFile

StorageFile object for which the file will be created

Exceptions
FileNotFoundException:
if the file exists but is a directory or cannot be opened

Method Detail

closeback to summary
pack-priv void close() throws IOException

Closes the file.

Exceptions
IOException:
if an I/O error occurs
StandardException:
it won't be thrown, it's in signature to allow subclasses to throw StandardException
getFilePointerback to summary
pack-priv long getFilePointer() throws IOException

Returns the current position of the file pointer.

Returns:long

file pointer

Exceptions
IOException:
if an I/O error occurs
getStorageFileback to summary
pack-priv StorageFile getStorageFile()

Get the StorageFile which represents the file where the contents of the LOB are stored.

Returns:StorageFile

a StorageFile instance

lengthback to summary
pack-priv long length() throws IOException

Returns length of the file.

Returns:long

length of the file

Exceptions
IOException:
if an I/O error occurs
readback to summary
pack-priv int read(byte[] buff, int off, int len) throws IOException, StandardException

Reads len number of bytes from the file starting from off position in the buffer.

Parameters
buff:byte[]

buffer

off:int

starting position of buffer

len:int

number of bytes

Returns:int

number of bytes read

Exceptions
IOException:
if an I/O error occurs
StandardException:
it won't be thrown, it's in signature to allow subclasses to throw StandardException
readByteback to summary
pack-priv int readByte() throws IOException, StandardException

Reads one byte from file.

Returns:int

byte

Exceptions
IOException:
if disk operation fails
StandardException:
it won't be thrown, it's in signature to allow subclasses to throw StandardException
seekback to summary
pack-priv void seek(long pos) throws IOException

Sets the file pointer to a given position.

Parameters
pos:long

new position

Exceptions
IOException:
if an I/O error occurs
setLengthback to summary
pack-priv void setLength(long size) throws IOException, StandardException

Sets the file length to a given size.

Parameters
size:long

new size

Exceptions
IOException:
if an I/O error occurs
StandardException:
it won't be thrown, it's in signature to allow subclasses to throw StandardException
writeback to summary
pack-priv void write(int b) throws IOException, StandardException

Writes one bytes into the file.

Parameters
b:int

int value of the byte

Exceptions
IOException:
if an I/O error occurs
StandardException:
it won't be thrown, it's in signature to allow subclasses to throw StandardException
writeback to summary
pack-priv void write(byte[] b, int off, int len) throws IOException, StandardException

Writes a segment of bytes into the file.

Parameters
b:byte[]

byte array containing bytes to write into the file

off:int

starting position of segment

len:int

number of bytes to be written

Exceptions
IOException:
if an I/O error occurs
StandardException:
it won't be thrown, it's in signature to allow subclasses to throw StandardException
writeback to summary
pack-priv void write(byte[] buf) throws IOException, StandardException

Writes a buffer completely into the file.

Parameters
buf:byte[]

buffer to write

Exceptions
IOException:
if an I/O error occurs
StandardException:
it won't be thrown, it's in signature to allow subclasses to throw StandardException