Top Description Inners Fields Constructors Methods
org.hsqldb.jdbc

public Class JDBCClobFile

extends Object
implements Clob
Class Inheritance
All Implemented Interfaces
java.sql.Clob, java.lang.AutoCloseable
Imports
java.io.BufferedInputStream, .BufferedWriter, .CharArrayWriter, .File, .FileInputStream, .FileNotFoundException, .IOException, .InputStream, .InputStreamReader, .OutputStream, .OutputStreamWriter, .RandomAccessFile, .Reader, .StringWriter, .UnsupportedEncodingException, .Writer, java.nio.ByteBuffer, .CharBuffer, java.nio.charset.Charset, .CharsetEncoder, .CodingErrorAction, .IllegalCharsetNameException, java.sql.Clob, .SQLException, java.util.Scanner, java.util.regex.MatchResult, .Pattern, .PatternSyntaxException, org.hsqldb.error.ErrorCode, org.hsqldb.jdbc.JDBCBlobFile.OutputStreamAdapter, org.hsqldb.lib.FileUtil, .FrameworkLogger, .HsqlArrayList, .InOutUtil, .Iterator, .List

A client-side file-based implementation of Clob.

HSQLDB-Specific Information:

Starting with 2.1, in addition to HSQLDB driver support for both client-side in-memory and remote SQL CLOB data implementations, this class is provided to expose efficient, relatively high-performance CLOB operations over client accessible files.

Design Notes

Although it is possible to implement a transactional version of this class, the present implementation directly propagates changes to the underlying file such that changes become visible as soon as they are either implicitly or explicitly flushed to disk.

Author
Campbell Burnet (campbell-burnet@users dot sourceforge.net)
Since
HSQLDB 2.1
Version
2.7.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
protected class

Field Summary

Modifier and TypeField and Description
private static final FrameworkLogger
private Charset
private boolean
private boolean
private CharsetEncoder
private String
private final File
private boolean
private int
private List<Object>
public static final String
public static final String

Constructor Summary

AccessConstructor and Description
public
JDBCClobFile()

Convenience constructor for JDBCClobFile((String)null).

public
JDBCClobFile(String
the name of the character encoding used to read and write character data in the underlying file, as well as to determine the character length of and character offsets into the underlying file. Specify null to denote the platform encoding.
encoding
)

Constructs a new JDBCClobFile instance backed by a File object created by File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX), using the given encoding to read and write file content.

public
JDBCClobFile(File
that is to back the new CLOB instance.
file
)

Convenience constructor for JDBCClobFile(file,null).

public
JDBCClobFile(File
that is to back the new CLOB instance.
file
,
String
the name of the character encoding used to read and write character data in the underlying file, as well as to determine the character length of and character offsets into the underlying file. Specify null to denote the platform encoding.
encoding
)

Constructs a new JDBCClobFile instance backed by the given File object using the given encoding to read and write file content.

Method Summary

Modifier and TypeMethod and Description
protected static Charset
charsetForName(final String charsetName)

protected void
protected final void
checkIsFile(final boolean checkExists)

private static void
private static void
closeSafely(final InputStream target)

private static void
closeSafely(final OutputStream target)

private static void
closeSafely(final Reader target)

private static void
closeSafely(final Writer target)

private static void
closeSafely(final Scanner target)

private void
closeSafely(final Object target)

protected void
private void
fillSpace(final long
inclusive
startPos
,
long
exclusive
endPos
)

public synchronized void
free()

Implements java.sql.Clob.free.

This method frees the Clob object and releases the resources that it holds.

public InputStream

Returns:

a java.io.InputStream object containing the CLOB data
getAsciiStream
()

Implements java.sql.Clob.getAsciiStream.

Retrieves the CLOB value designated by this Clob object as an ASCII stream.

public Reader

Returns:

a java.io.Reader object containing the CLOB data
getCharacterStream
()

Implements java.sql.Clob.getCharacterStream.

Retrieves the CLOB value designated by this Clob object as a java.io.Reader object (or as a stream of characters).

public Reader

Returns:

Reader through which the partial Clob value can be read.
getCharacterStream
(long
the offset to the first character of the partial value to be retrieved. The first character in the Clob is at position 1.
pos
,
long
the length in characters of the partial value to be retrieved.
length
)

Implements java.sql.Clob.getCharacterStream.

Returns a Reader object that contains a partial Clob value, starting with the character specified by pos, which is length characters in length.

public String
getEncoding()

Returns: the name of the character encoding used to read and write character data in the underlying files, as well as to determine the character length and character offsets into the underlying file

public File

Returns:

the file that backs this CLOB.
getFile
()

Retrieves the canonical File object denoting the file that backs this CLOB.

public String

Returns:

a String that is the specified substring in the CLOB value designated by this Clob object
getSubString
(final long
the first character of the substring to be extracted. The first character is at position 1.
pos
,
final int
the number of consecutive characters to be copied; the value for length must be 0 or greater
length
)

Implements java.sql.Clob.getSubString.

Retrieves a copy of the specified substring in the CLOB value designated by this Clob object.

public boolean

Returns:

true if backing file deletion is attempted; otherwise false.
isDeleteOnFree
()

Retrieves whether an attempt to delete the backing file is made in response to invocation of free().

public long

Returns:

length of the CLOB in characters
length
()

Implements java.sql.Clob.length.

Retrieves the number of characters in the CLOB value designated by this Clob object.

public long

Returns:

the position at which the substring appears or -1 if it is not present; the first position is 1
position
(final char[]
the substring for which to search
pattern
,
final long
the position at which to begin searching; the first position is 1
start
)

Retrieves the character position at which the specified char[] pattern appears in the CLOB value represented by this Clob object.

public long

Returns:

the position at which the substring appears or -1 if it is not present; the first position is 1
position
(String
the substring for which to search
searchstr
,
long
the position at which to begin searching; the first position is 1
start
)

Implements java.sql.Clob.position.

Retrieves the character position at which the specified substring searchstr appears in the SQL CLOB value represented by this Clob object.

public long

Returns:

the position at which the Clob object appears or -1 if it is not present; the first position is 1
position
(final Clob
the Clob object for which to search
pattern
,
final long
the position at which to begin searching; the first position is 1
start
)

Implements java.sql.Clob.position.

Retrieves the character position at which the specified Clob object searchstr appears in this Clob object.

private long

Returns:

the position at which the substring appears or -1 if it is not present; the first position is 1
position0
(final String
for which to search
pattern
,
final long
position at which to begin searching; the first position is 1
start
)

Retrieves the character position at which the specified pattern appears in the SQL CLOB value represented by this Clob object.

public OutputStream

Returns:

the stream to which ASCII encoded characters can be written
setAsciiStream
(long
the position at which to start writing to this CLOB object; The first position is 1
pos
)

Implements java.sql.Clob.setAsciiStream.

Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, starting at position pos.

public Writer

Returns:

a stream to which Unicode encoded characters can be written
setCharacterStream
(final long
the position at which to start writing to the CLOB value; The first position is 1
pos
)

Implements java.sql.Clob.setCharacterStream.

Retrieves a stream to be used to write a stream of Unicode characters to the CLOB value that this Clob object represents, at position pos.

public void
setDeleteOnFree(boolean
the new value to assign
deleteOnFree
)

Assigns whether an attempt to delete the backing file is made in response to invocation of free().

protected final void
setEncoding(final String encoding)

public int

Returns:

the number of characters written
setString
(final long
the position at which to start writing to the CLOB value that this Clob object represents; The first position is 1
pos
,
final String
the string to be written to the CLOB value that this Clob designates
str
)

Implements java.sql.Clob.setString.

Writes the given Java String to the CLOB value that this Clob object designates at the position pos.

public int

Returns:

the number of characters written
setString
(final long
the position at which to start writing to this CLOB object; The first position is 1
pos
,
final String
the string to be written to the CLOB value that this Clob object represents
str
,
final int
the offset into str to start reading the characters to be written
offset
,
final int
the number of characters to be written
len
)

Implements java.sql.Clob.setString.

Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.

public void
truncate(long
the length, in characters, to which the CLOB value should be truncated
len
)

Implements java.sql.Clob.truncate.

Truncates the CLOB value that this Clob designates to have a length of len characters.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final FrameworkLogger LOG
m_charsetback to summary
private Charset m_charset
m_closedback to summary
private boolean m_closed
m_deleteOnFreeback to summary
private boolean m_deleteOnFree
m_encoderback to summary
private CharsetEncoder m_encoder
m_encodingback to summary
private String m_encoding
m_fileback to summary
private final File m_file
m_fixedWidthCharsetback to summary
private boolean m_fixedWidthCharset
m_maxCharWidthback to summary
private int m_maxCharWidth
m_streamsback to summary
private List<Object> m_streams
TEMP_FILE_PREFIXback to summary
public static final String TEMP_FILE_PREFIX
TEMP_FILE_SUFFIXback to summary
public static final String TEMP_FILE_SUFFIX

Constructor Detail

JDBCClobFileback to summary
public JDBCClobFile() throws SQLException

Convenience constructor for JDBCClobFile((String)null).

Exceptions
SQLException:
if the platform encoding is unsupported, the temp file cannot be created or some other error occurs that prevents the construction of a valid instance of this class.
JDBCClobFileback to summary
public JDBCClobFile(String encoding) throws SQLException

Constructs a new JDBCClobFile instance backed by a File object created by File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX), using the given encoding to read and write file content.

Parameters
encoding:String

the name of the character encoding used to read and write character data in the underlying file, as well as to determine the character length of and character offsets into the underlying file. Specify null to denote the platform encoding.

Exceptions
SQLException:
if the given encoding is unsupported, the backing temp file could not be created or if a security manager exists and its {@link java.lang.SecurityManager#checkWrite(java.lang.String)} method does not allow a file to be created.
JDBCClobFileback to summary
public JDBCClobFile(File file) throws SQLException

Convenience constructor for JDBCClobFile(file,null).

Parameters
file:File

that is to back the new CLOB instance.

Exceptions
SQLException:
if an I/O error occurs, which is possible because the construction of the canonical pathname may require file-system queries; a required system property value cannot be accessed; a security manager exists and its {@link java.lang.SecurityManager#checkRead} method denies read access to the file
JDBCClobFileback to summary
public JDBCClobFile(File file, String encoding) throws SQLException

Constructs a new JDBCClobFile instance backed by the given File object using the given encoding to read and write file content.

Parameters
file:File

that is to back the new CLOB instance.

encoding:String

the name of the character encoding used to read and write character data in the underlying file, as well as to determine the character length of and character offsets into the underlying file. Specify null to denote the platform encoding.

Exceptions
SQLException:
if the given encoding is unsupported; an I/O error occurs, which is possible because the construction of the canonical pathname may require file-system queries; a required system property value cannot be accessed; a security manager exists and its {@link java.lang.SecurityManager#checkRead} method denies read access to the file

Method Detail

charsetForNameback to summary
protected static Charset charsetForName(final String charsetName) throws UnsupportedEncodingException
checkClosedback to summary
protected void checkClosed() throws SQLException
checkIsFileback to summary
protected final void checkIsFile(final boolean checkExists) throws SQLException
closeSafelyback to summary
private static void closeSafely(final RandomAccessFile target)
closeSafelyback to summary
private static void closeSafely(final InputStream target)
closeSafelyback to summary
private static void closeSafely(final OutputStream target)
closeSafelyback to summary
private static void closeSafely(final Reader target)
closeSafelyback to summary
private static void closeSafely(final Writer target)
closeSafelyback to summary
private static void closeSafely(final Scanner target)
closeSafelyback to summary
private void closeSafely(final Object target)
createFileback to summary
protected void createFile() throws SQLException
fillSpaceback to summary
private void fillSpace(final long startPos, long endPos) throws SQLException
Parameters
startPos:long

inclusive

endPos:long

exclusive

Exceptions
SQLException:
exception
freeback to summary
public synchronized void free() throws SQLException

Implements java.sql.Clob.free.

This method frees the Clob object and releases the resources that it holds. The object is invalid once the free method is called.

After free has been called, any attempt to invoke a method other than free will result in a SQLException being thrown. If free is called multiple times, the subsequent calls to free are treated as a no-op.

Exceptions
SQLException:
if an error occurs releasing the Clob's resources
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.4
getAsciiStreamback to summary
public InputStream getAsciiStream() throws SQLException

Implements java.sql.Clob.getAsciiStream.

Retrieves the CLOB value designated by this Clob object as an ASCII stream.

Returns:InputStream

a java.io.InputStream object containing the CLOB data

Exceptions
SQLException:
if there is an error accessing the CLOB value
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.2
See Also
setAsciiStream
getCharacterStreamback to summary
public Reader getCharacterStream() throws SQLException

Implements java.sql.Clob.getCharacterStream.

Retrieves the CLOB value designated by this Clob object as a java.io.Reader object (or as a stream of characters).

Returns:Reader

a java.io.Reader object containing the CLOB data

Exceptions
SQLException:
if there is an error accessing the CLOB value
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.2
See Also
setCharacterStream
getCharacterStreamback to summary
public Reader getCharacterStream(long pos, long length) throws SQLException

Implements java.sql.Clob.getCharacterStream.

Returns a Reader object that contains a partial Clob value, starting with the character specified by pos, which is length characters in length.

Parameters
pos:long

the offset to the first character of the partial value to be retrieved. The first character in the Clob is at position 1.

length:long

the length in characters of the partial value to be retrieved.

Returns:Reader

Reader through which the partial Clob value can be read.

Exceptions
SQLException:
if pos is less than 1 or if pos is greater than the number of characters in the Clob or if pos + length is greater than the number of characters in the Clob
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.6
getEncodingback to summary
public String getEncoding()
Returns:String

the name of the character encoding used to read and write character data in the underlying files, as well as to determine the character length and character offsets into the underlying file

getFileback to summary
public File getFile()

Retrieves the canonical File object denoting the file that backs this CLOB.

Returns:File

the file that backs this CLOB.

getSubStringback to summary
public String getSubString(final long pos, final int length) throws SQLException

Implements java.sql.Clob.getSubString.

Retrieves a copy of the specified substring in the CLOB value designated by this Clob object. The substring begins at position pos and has up to length consecutive characters.

Parameters
pos:long

the first character of the substring to be extracted. The first character is at position 1.

length:int

the number of consecutive characters to be copied; the value for length must be 0 or greater

Returns:String

a String that is the specified substring in the CLOB value designated by this Clob object

Exceptions
SQLException:
if there is an error accessing the CLOB value; if pos is less than 1 or length is less than 0
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.2
isDeleteOnFreeback to summary
public boolean isDeleteOnFree()

Retrieves whether an attempt to delete the backing file is made in response to invocation of free().

Returns:boolean

true if backing file deletion is attempted; otherwise false.

lengthback to summary
public long length() throws SQLException

Implements java.sql.Clob.length.

Retrieves the number of characters in the CLOB value designated by this Clob object.

Returns:long

length of the CLOB in characters

Exceptions
SQLException:
if there is an error accessing the length of the CLOB value
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.2
positionback to summary
public long position(final char[] pattern, final long start) throws SQLException

Retrieves the character position at which the specified char[] pattern appears in the CLOB value represented by this Clob object. The search begins at position start.

Parameters
pattern:char[]

the substring for which to search

start:long

the position at which to begin searching; the first position is 1

Returns:long

the position at which the substring appears or -1 if it is not present; the first position is 1

Exceptions
SQLException:
if there is an error accessing the CLOB value or if pos is less than 1
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
positionback to summary
public long position(String searchstr, long start) throws SQLException

Implements java.sql.Clob.position.

Retrieves the character position at which the specified substring searchstr appears in the SQL CLOB value represented by this Clob object. The search begins at position start.

Parameters
searchstr:String

the substring for which to search

start:long

the position at which to begin searching; the first position is 1

Returns:long

the position at which the substring appears or -1 if it is not present; the first position is 1

Exceptions
SQLException:
if there is an error accessing the CLOB value or if pos is less than 1
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.2
positionback to summary
public long position(final Clob pattern, final long start) throws SQLException

Implements java.sql.Clob.position.

Retrieves the character position at which the specified Clob object searchstr appears in this Clob object. The search begins at position start.

Parameters
pattern:Clob

the Clob object for which to search

start:long

the position at which to begin searching; the first position is 1

Returns:long

the position at which the Clob object appears or -1 if it is not present; the first position is 1

Exceptions
SQLException:
if there is an error accessing the CLOB value or if start is less than 1
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.2
position0back to summary
private long position0(final String pattern, final long start) throws SQLException

Retrieves the character position at which the specified pattern appears in the SQL CLOB value represented by this Clob object. The search begins at position start.

Parameters
pattern:String

for which to search

start:long

position at which to begin searching; the first position is 1

Returns:long

the position at which the substring appears or -1 if it is not present; the first position is 1

Exceptions
SQLException:
if there is an error accessing the CLOB value or if start is less than 1
setAsciiStreamback to summary
public OutputStream setAsciiStream(long pos) throws SQLException

Implements java.sql.Clob.setAsciiStream.

Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, starting at position pos. Characters written to the stream will overwrite the existing characters in the Clob object starting at the position pos. If the end of the Clob value is reached while writing characters to the stream, then the length of the Clob value will be increased to accommodate the extra characters.

Note

If the value specified for pos is greater than the length+1 of the CLOB value then the behavior is undefined. Some JDBC drivers may throw a SQLException while other drivers may support this operation.

Parameters
pos:long

the position at which to start writing to this CLOB object; The first position is 1

Returns:OutputStream

the stream to which ASCII encoded characters can be written

Exceptions
SQLException:
if there is an error accessing the CLOB value or if pos is less than 1
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.4
See Also
getAsciiStream
setCharacterStreamback to summary
public Writer setCharacterStream(final long pos) throws SQLException

Implements java.sql.Clob.setCharacterStream.

Retrieves a stream to be used to write a stream of Unicode characters to the CLOB value that this Clob object represents, at position pos. Characters written to the stream will overwrite the existing characters in the Clob object starting at the position pos. If the end of the Clob value is reached while writing characters to the stream, then the length of the Clob value will be increased to accommodate the extra characters.

Note

If the value specified for pos is greater than the length+1 of the CLOB value then the behavior is undefined. Some JDBC drivers may throw a SQLException while other drivers may support this operation.

HSQLDB-Specific Information:

When the value specified for pos is greater then the length+1, an SQLException is thrown.
Parameters
pos:long

the position at which to start writing to the CLOB value; The first position is 1

Returns:Writer

a stream to which Unicode encoded characters can be written

Exceptions
SQLException:
if there is an error accessing the CLOB value or if pos is less than 1
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.4
See Also
getCharacterStream
setDeleteOnFreeback to summary
public void setDeleteOnFree(boolean deleteOnFree)

Assigns whether an attempt to delete the backing file is made in response to invocation of free().

Parameters
deleteOnFree:boolean

the new value to assign

setEncodingback to summary
protected final void setEncoding(final String encoding) throws UnsupportedEncodingException
setStringback to summary
public int setString(final long pos, final String str) throws SQLException

Implements java.sql.Clob.setString.

Writes the given Java String to the CLOB value that this Clob object designates at the position pos. The string will overwrite the existing characters in the Clob object starting at the position pos. If the end of the Clob value is reached while writing the given string, then the length of the Clob value will be increased to accommodate the extra characters.

Note

If the value specified for pos is greater than the length+1 of the CLOB value then the behavior is undefined. Some JDBC drivers may throw a SQLException while other drivers may support this operation.

Parameters
pos:long

the position at which to start writing to the CLOB value that this Clob object represents; The first position is 1

str:String

the string to be written to the CLOB value that this Clob designates

Returns:int

the number of characters written

Exceptions
SQLException:
if there is an error accessing the CLOB value or if pos is less than 1
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.4
setStringback to summary
public int setString(final long pos, final String str, final int offset, final int len) throws SQLException

Implements java.sql.Clob.setString.

Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents. The string will overwrite the existing characters in the Clob object starting at the position pos. If the end of the Clob value is reached while writing the given string, then the length of the Clob value will be increased to accommodate the extra characters.

Note

If the value specified for pos is greater than the length+1 of the CLOB value then the behavior is undefined. Some JDBC drivers may throw a SQLException while other drivers may support this operation.

Parameters
pos:long

the position at which to start writing to this CLOB object; The first position is 1

str:String

the string to be written to the CLOB value that this Clob object represents

offset:int

the offset into str to start reading the characters to be written

len:int

the number of characters to be written

Returns:int

the number of characters written

Exceptions
SQLException:
if there is an error accessing the CLOB value or if pos is less than 1
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.4
truncateback to summary
public void truncate(long len) throws SQLException

Implements java.sql.Clob.truncate.

Truncates the CLOB value that this Clob designates to have a length of len characters.

Note

If the value specified for pos is greater than the length+1 of the CLOB value then the behavior is undefined. Some JDBC drivers may throw a SQLException while other drivers may support this operation.

Parameters
len:long

the length, in characters, to which the CLOB value should be truncated

Exceptions
SQLException:
if there is an error accessing the CLOB value or if len is less than 0
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.4
org.hsqldb.jdbc back to summary

protected Class JDBCClobFile.ReaderAdapter

extends Reader
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final int
private ByteBuffer
private CharBuffer
private long
private final Reader
private long
Inherited from java.io.Reader:
lock

Constructor Summary

AccessConstructor and Description
protected
ReaderAdapter(final File file, final long pos, final long length)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Closes the stream and releases any system resources associated with it.

public long
public int
read(final char[] cbuf, final int off, int len)

Implements abstract java.io.Reader.read.

Reads characters into a portion of an array.

Inherited from java.io.Reader:
markmarkSupportednullReaderofreadreadreadreadAllAsStringreadAllLinesreadyresetskiptransferTo

Field Detail

CHARBUFFER_CAPACTIYback to summary
private static final int CHARBUFFER_CAPACTIY
m_byteBufferback to summary
private ByteBuffer m_byteBuffer
m_charBufferback to summary
private CharBuffer m_charBuffer
m_filePointerback to summary
private long m_filePointer
m_readerback to summary
private final Reader m_reader
m_remainingback to summary
private long m_remaining

Constructor Detail

ReaderAdapterback to summary
protected ReaderAdapter(final File file, final long pos, final long length) throws IOException, NullPointerException, IllegalArgumentException, SecurityException

Method Detail

closeback to summary
public void close() throws IOException

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Doc from java.io.Reader.close.

Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.

Exceptions
IOException:
If an I/O error occurs
getFilePointerback to summary
public long getFilePointer()
readback to summary
public int read(final char[] cbuf, final int off, int len) throws IOException

Implements abstract java.io.Reader.read.

Doc from java.io.Reader.read.

Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If len is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Exceptions
IOException:
If an I/O error occurs
org.hsqldb.jdbc back to summary

protected Class JDBCClobFile.WriterAdapter

extends Writer
Class Inheritance

Field Summary

Modifier and TypeField and Description
protected final Writer
Inherited from java.io.Writer:
lock

Constructor Summary

AccessConstructor and Description
protected
WriterAdapter(final File file, final long pos)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Closes the stream, flushing it first.

public void
flush()

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Flushes the stream.

public void
write(char[] cbuf, int off, int len)

Implements abstract java.io.Writer.write.

Writes a portion of an array of characters.

Inherited from java.io.Writer:
appendappendappendnullWriterwritewritewritewrite

Field Detail

m_writerback to summary
protected final Writer m_writer

Constructor Detail

WriterAdapterback to summary
protected WriterAdapter(final File file, final long pos) throws IOException, SecurityException, NullPointerException, IllegalArgumentException

Method Detail

closeback to summary
public void close() throws IOException

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Doc from java.io.Writer.close.

Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.

Exceptions
IOException:
If an I/O error occurs
flushback to summary
public void flush() throws IOException

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Doc from java.io.Writer.flush.

Flushes the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.

If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.

Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(char[] cbuf, int off, int len) throws IOException

Implements abstract java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a portion of an array of characters.

Exceptions
IOException:
If an I/O error occurs