Search in sources :

Example 1 with HsqlByteArrayInputStream

use of org.hsqldb_voltpatches.lib.HsqlByteArrayInputStream in project voltdb by VoltDB.

the class LobManager method getChars.

public Result getChars(Session session, long lobID, long offset, int length) {
    Result result = getBytes(session, lobID, offset * 2, length * 2);
    if (result.isError()) {
        return result;
    }
    byte[] bytes = ((ResultLob) result).getByteArray();
    HsqlByteArrayInputStream be = new HsqlByteArrayInputStream(bytes);
    char[] chars = new char[bytes.length / 2];
    try {
        for (int i = 0; i < chars.length; i++) {
            chars[i] = be.readChar();
        }
    } catch (Exception e) {
        return Result.newErrorResult(e);
    }
    return ResultLob.newLobGetCharsResponse(lobID, offset, chars);
}
Also used : HsqlByteArrayInputStream(org.hsqldb_voltpatches.lib.HsqlByteArrayInputStream) IOException(java.io.IOException) EOFException(java.io.EOFException) HsqlException(org.hsqldb_voltpatches.HsqlException) Result(org.hsqldb_voltpatches.result.Result) ResultLob(org.hsqldb_voltpatches.result.ResultLob)

Aggregations

EOFException (java.io.EOFException)1 IOException (java.io.IOException)1 HsqlException (org.hsqldb_voltpatches.HsqlException)1 HsqlByteArrayInputStream (org.hsqldb_voltpatches.lib.HsqlByteArrayInputStream)1 Result (org.hsqldb_voltpatches.result.Result)1 ResultLob (org.hsqldb_voltpatches.result.ResultLob)1