本文整理汇总了Java中org.hsqldb.lib.HsqlByteArrayOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java HsqlByteArrayOutputStream类的具体用法?Java HsqlByteArrayOutputStream怎么用?Java HsqlByteArrayOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HsqlByteArrayOutputStream类属于org.hsqldb.lib包,在下文中一共展示了HsqlByteArrayOutputStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RAFile
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
RAFile(EventLogInterface logger, String name, boolean readonly,
boolean extendLengthToBlock,
boolean commitOnChange) throws FileNotFoundException, IOException {
this.logger = logger;
this.fileName = name;
this.readOnly = readonly;
this.extendLength = extendLengthToBlock;
String accessMode = readonly ? "r"
: commitOnChange ? "rws"
: "rw";
this.file = new RandomAccessFile(name, accessMode);
buffer = new byte[bufferSize];
ba = new HsqlByteArrayInputStream(buffer);
valueBuffer = new byte[8];
vbao = new HsqlByteArrayOutputStream(valueBuffer);
vbai = new HsqlByteArrayInputStream(valueBuffer);
fileDescriptor = file.getFD();
fileLength = length();
readIntoBuffer();
}
示例2: RAShadowFile
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
RAShadowFile(Database database, RandomAccessInterface source,
String pathName, long maxSize, int pageSize) {
this.database = database;
this.pathName = pathName;
this.source = source;
this.pageSize = pageSize;
this.maxSize = maxSize;
int bitSize = (int) (maxSize / pageSize);
if (maxSize % pageSize != 0) {
bitSize++;
}
bitMap = new BitMap(bitSize, false);
buffer = new byte[pageSize + headerSize];
byteArrayOutputStream = new HsqlByteArrayOutputStream(buffer);
}
示例3: clearRowImage
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void clearRowImage(CachedObject row) {
try {
int length = row.getStorageSize();
int count = length - textFileSettings.bytesForLineEnd.length;
rowOut.reset();
HsqlByteArrayOutputStream out = rowOut.getOutputStream();
for (; count > 0; count -= textFileSettings.bytesForSpace.length) {
out.write(textFileSettings.bytesForSpace);
}
out.write(textFileSettings.bytesForLineEnd);
dataFile.seek(row.getPos());
dataFile.write(out.getBuffer(), 0, out.size());
} catch (Throwable t) {
throw Error.runtimeError(ErrorCode.U_S0500, t.getMessage());
}
}
示例4: setBlobForBinaryParameter
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
* Converts a blob to binary data for non-blob binary parameters.
*/
private void setBlobForBinaryParameter(int parameterIndex,
Blob x) throws SQLException {
if (x instanceof JDBCBlob) {
setParameter(parameterIndex, ((JDBCBlob) x).data());
return;
} else if (x == null) {
setParameter(parameterIndex, null);
return;
}
final long length = x.length();
if (length > Integer.MAX_VALUE) {
String msg = "Maximum Blob input octet length exceeded: " + length; // NOI18N
throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
}
try {
java.io.InputStream in = x.getBinaryStream();
HsqlByteArrayOutputStream out = new HsqlByteArrayOutputStream(in,
(int) length);
setParameter(parameterIndex, out.toByteArray());
out.close();
} catch (Throwable e) {
throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
e.toString(), e);
}
}
示例5: write
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
protected void write(Result r) throws IOException, HsqlException {
HsqlByteArrayOutputStream memStream = new HsqlByteArrayOutputStream();
DataOutputStream tempOutput = new DataOutputStream(memStream);
r.write(this, tempOutput, rowOut);
httpConnection.setRequestMethod("POST");
httpConnection.setDoOutput(true);
httpConnection.setUseCaches(false);
//httpConnection.setRequestProperty("Accept-Encoding", "gzip");
httpConnection.setRequestProperty("Content-Type",
"application/octet-stream");
httpConnection.setRequestProperty("Content-Length",
String.valueOf(IDLENGTH
+ memStream.size()));
dataOutput = new DataOutputStream(httpConnection.getOutputStream());
dataOutput.writeInt(r.getDatabaseId());
dataOutput.writeLong(r.getSessionId());
memStream.writeTo(dataOutput);
dataOutput.flush();
}
示例6: clearRowImage
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void clearRowImage(CachedObject row) {
try {
int length = row.getStorageSize()
- ScriptWriterText.BYTES_LINE_SEP.length;
rowOut.reset();
HsqlByteArrayOutputStream out = rowOut.getOutputStream();
out.fill(' ', length);
out.write(ScriptWriterText.BYTES_LINE_SEP);
dataFile.seek(row.getPos());
dataFile.write(out.getBuffer(), 0, out.size());
} catch (IOException e) {
throw Error.runtimeError(ErrorCode.U_S0500, e.getMessage());
}
}
示例7: setBlobForBinaryParameter
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
* Converts a blob to binary data for non-blob binary parameters.
*/
private void setBlobForBinaryParameter(int parameterIndex,
Blob x) throws SQLException {
if (x instanceof JDBCBlob) {
setParameter(parameterIndex, ((JDBCBlob) x).data());
return;
} else if (x == null) {
setParameter(parameterIndex, null);
return;
}
checkSetParameterIndex(parameterIndex, true);
final long length = x.length();
if (length > Integer.MAX_VALUE) {
String msg = "Maximum Blob input octet length exceeded: " + length; // NOI18N
throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
}
try {
java.io.InputStream in = x.getBinaryStream();
HsqlByteArrayOutputStream out = new HsqlByteArrayOutputStream(in,
(int) length);
setParameter(parameterIndex, out.toByteArray());
} catch (IOException e) {
throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
e.toString());
}
}
示例8: RAFile
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
RAFile(Database database, String name, boolean readonly,
boolean extendLengthToBlock,
boolean commitOnChange) throws FileNotFoundException, IOException {
this.database = database;
this.fileName = name;
this.readOnly = readonly;
this.extendLength = extendLengthToBlock;
String accessMode = readonly ? "r"
: commitOnChange ? "rws"
: "rw";
this.file = new RandomAccessFile(name, accessMode);
buffer = new byte[bufferSize];
ba = new HsqlByteArrayInputStream(buffer);
valueBuffer = new byte[8];
vbao = new HsqlByteArrayOutputStream(valueBuffer);
vbai = new HsqlByteArrayInputStream(valueBuffer);
fileDescriptor = file.getFD();
fileLength = length();
readIntoBuffer();
}
示例9: RAShadowFile
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
RAShadowFile(Database database, RandomAccessInterface source,
String pathName, long maxSize, int pageSize) {
this.database = database;
this.pathName = pathName;
this.source = source;
this.pageSize = pageSize;
this.maxSize = maxSize;
int bitSize = (int) (maxSize / pageSize);
if (maxSize % pageSize != 0) {
bitSize++;
}
bitMap = new BitMap(bitSize, false);
buffer = new byte[pageSize + 12];
byteArrayOutputStream = new HsqlByteArrayOutputStream(buffer);
}
示例10: clearRowImage
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void clearRowImage(CachedObject row) {
try {
int length = row.getStorageSize()
- ScriptWriterText.BYTES_LINE_SEP.length;
rowOut.reset();
HsqlByteArrayOutputStream out = rowOut.getOutputStream();
out.fill(' ', length);
out.write(ScriptWriterText.BYTES_LINE_SEP);
dataFile.seek(row.getPos());
dataFile.write(out.getBuffer(), 0, out.size());
} catch (Throwable t) {
throw Error.runtimeError(ErrorCode.U_S0500, t.getMessage());
}
}
示例11: setBlobForBinaryParameter
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
* Converts a blob to binary data for non-blob binary parameters.
*/
private void setBlobForBinaryParameter(int parameterIndex,
Blob x) throws SQLException {
if (x instanceof JDBCBlob) {
setParameter(parameterIndex, ((JDBCBlob) x).data());
return;
} else if (x == null) {
setParameter(parameterIndex, null);
return;
}
final long length = x.length();
if (length > Integer.MAX_VALUE) {
String msg = "Maximum Blob input octet length exceeded: " + length; // NOI18N
throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
}
try {
java.io.InputStream in = x.getBinaryStream();
HsqlByteArrayOutputStream out = new HsqlByteArrayOutputStream(in,
(int) length);
setParameter(parameterIndex, out.toByteArray());
} catch (Throwable e) {
throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
e.toString(), e);
}
}
示例12: free
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
*
*/
void free(CachedRow r) throws HsqlException {
if (storeOnInsert &&!isIndexingSource) {
int pos = r.iPos;
int length = r.storageSize
- ScriptWriterText.BYTES_LINE_SEP.length;
rowOut.reset();
HsqlByteArrayOutputStream out = rowOut.getOutputStream();
try {
out.fill(' ', length);
out.write(ScriptWriterText.BYTES_LINE_SEP);
dataFile.seek(pos);
dataFile.write(out.getBuffer(), 0, out.size());
} catch (IOException e) {
throw (Trace.error(Trace.FILE_IO_ERROR, e.toString()));
}
}
remove(r);
}
示例13: getStackTrace
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
* Returns the stack trace for doAssert()
*/
private static String getStackTrace() {
try {
Exception e = new Exception();
throw e;
} catch (Exception e1) {
HsqlByteArrayOutputStream os = new HsqlByteArrayOutputStream();
PrintWriter pw = new PrintWriter(os, true);
e1.printStackTrace(pw);
return os.toString();
}
}
示例14: ScaledRAFile
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
ScaledRAFile(Database database, String name, boolean readonly,
boolean extendLengthToBlock)
throws FileNotFoundException, IOException {
this.database = database;
this.fileName = name;
this.readOnly = readonly;
this.extendLength = extendLengthToBlock;
String accessMode = readonly ? "r"
: extendLength ? "rw"
: "rws";
this.file = new RandomAccessFile(name, accessMode);
buffer = new byte[bufferSize];
ba = new HsqlByteArrayInputStream(buffer);
valueBuffer = new byte[8];
vbao = new HsqlByteArrayOutputStream(valueBuffer);
vbai = new HsqlByteArrayInputStream(valueBuffer);
fileDescriptor = file.getFD();
fileLength = length();
readIntoBuffer();
}
示例15: allocateBlobSegments
import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void allocateBlobSegments(ResultLob result,
InputStream stream) throws IOException {
//
long currentOffset = result.getOffset();
int bufferLength = session.getStreamBlockSize();
HsqlByteArrayOutputStream byteArrayOS =
new HsqlByteArrayOutputStream(bufferLength);
while (true) {
byteArrayOS.reset();
byteArrayOS.write(stream, bufferLength);
byte[] byteArray = byteArrayOS.getBuffer();
Result actionResult =
database.lobManager.setBytes(result.getLobID(), currentOffset,
byteArray, byteArrayOS.size());
currentOffset += byteArrayOS.size();
if (byteArrayOS.size() < bufferLength) {
return;
}
}
}