本文整理了Java中org.h2.value.Value.getInputStream()
方法的一些代码示例,展示了Value.getInputStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.getInputStream()
方法的具体详情如下:
包路径:org.h2.value.Value
类名称:Value
方法名:getInputStream
[英]Get the input stream
[中]获取输入流
代码示例来源:origin: com.h2database/h2
/**
* Returns the input stream.
*
* @return the input stream
*/
@Override
public InputStream getBinaryStream() throws SQLException {
try {
debugCodeCall("getBinaryStream");
checkClosed();
return value.getInputStream();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.h2database/h2
@Override
public InputStream getInputStream(long oneBasedOffset, long length) {
if (fileName == null) {
return super.getInputStream(oneBasedOffset, length);
}
FileStore store = handler.openFile(fileName, "r", true);
boolean alwaysClose = SysProperties.lobCloseBetweenReads;
InputStream inputStream = new BufferedInputStream(
new FileStoreInputStream(store, handler, compressed, alwaysClose),
Constants.IO_BUFFER_SIZE);
return rangeInputStream(inputStream, oneBasedOffset, length, store.length());
}
代码示例来源:origin: com.h2database/h2
/**
* Returns the input stream, starting from an offset.
*
* @param pos where to start reading
* @param length the number of bytes that will be read
* @return the input stream to read
*/
@Override
public InputStream getBinaryStream(long pos, long length) throws SQLException {
try {
debugCodeCall("getBinaryStream(pos, length)");
checkClosed();
return value.getInputStream(pos, length);
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.h2database/h2
/**
* Returns the value of the specified column as an input stream.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
@Override
public InputStream getBinaryStream(int columnIndex) throws SQLException {
try {
debugCodeCall("getBinaryStream", columnIndex);
return get(columnIndex).getInputStream();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.h2database/h2
/**
* Returns the value of the specified column as an input stream.
*
* @param columnLabel the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
@Override
public InputStream getBinaryStream(String columnLabel) throws SQLException {
try {
debugCodeCall("getBinaryStream", columnLabel);
return get(columnLabel).getInputStream();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.h2database/h2
case Value.BLOB: {
byte[] bytes = new byte[lobBlockSize];
try (InputStream input = v.getInputStream()) {
for (int i = 0;; i++) {
StringBuilder buff = new StringBuilder(lobBlockSize * 2);
代码示例来源:origin: com.h2database/h2
/**
* Returns some bytes of the object.
*
* @param pos the index, the first byte is at position 1
* @param length the number of bytes
* @return the bytes, at most length bytes
*/
@Override
public byte[] getBytes(long pos, int length) throws SQLException {
try {
if (isDebugEnabled()) {
debugCode("getBytes("+pos+", "+length+");");
}
checkClosed();
ByteArrayOutputStream out = new ByteArrayOutputStream();
try (InputStream in = value.getInputStream()) {
IOUtils.skipFully(in, pos - 1);
IOUtils.copy(in, out, length);
}
return out.toByteArray();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.h2database/h2
/**
* Returns the length.
*
* @return the length
*/
@Override
public long length() throws SQLException {
try {
debugCodeCall("length");
checkClosed();
if (value.getType() == Value.BLOB) {
long precision = value.getPrecision();
if (precision > 0) {
return precision;
}
}
return IOUtils.copyAndCloseInput(value.getInputStream(), null);
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.h2database/h2
@Override
public InputStream getInputStream(long oneBasedOffset, long length) {
long byteCount;
InputStream inputStream;
if (small != null) {
return super.getInputStream(oneBasedOffset, length);
} else if (fileName != null) {
FileStore store = handler.openFile(fileName, "r", true);
boolean alwaysClose = SysProperties.lobCloseBetweenReads;
byteCount = store.length();
inputStream = new BufferedInputStream(new FileStoreInputStream(store,
handler, false, alwaysClose), Constants.IO_BUFFER_SIZE);
} else {
byteCount = (type == Value.BLOB) ? precision : -1;
try {
inputStream = handler.getLobStorage().getInputStream(this, hmac, byteCount);
} catch (IOException e) {
throw DbException.convertIOException(e, toString());
}
}
return ValueLob.rangeInputStream(inputStream, oneBasedOffset, length, byteCount);
}
代码示例来源:origin: com.h2database/h2
try {
FileOutputStream fileOutputStream = new FileOutputStream(fileName);
try (InputStream in = v0.getInputStream()) {
result = ValueLong.get(IOUtils.copyAndClose(in,
fileOutputStream));
代码示例来源:origin: com.h2database/com.springsource.org.h2
/**
* Returns the input stream.
*
* @return the input stream
*/
public InputStream getBinaryStream() throws SQLException {
try {
debugCodeCall("getBinaryStream");
checkClosed();
return value.getInputStream();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
/**
* Returns the value of the specified column as input stream.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public InputStream getBinaryStream(int columnIndex) throws SQLException {
try {
debugCodeCall("getBinaryStream", columnIndex);
return get(columnIndex).getInputStream();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: org.wowtools/h2
/**
* Returns the value of the specified column as an input stream.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
@Override
public InputStream getBinaryStream(int columnIndex) throws SQLException {
try {
debugCodeCall("getBinaryStream", columnIndex);
return get(columnIndex).getInputStream();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: org.wowtools/h2
/**
* Returns the value of the specified column as an input stream.
*
* @param columnLabel the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
@Override
public InputStream getBinaryStream(String columnLabel) throws SQLException {
try {
debugCodeCall("getBinaryStream", columnLabel);
return get(columnLabel).getInputStream();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
/**
* Returns the value of the specified column as input stream.
*
* @param columnName the name of the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public InputStream getBinaryStream(String columnName) throws SQLException {
try {
debugCodeCall("getBinaryStream", columnName);
return get(columnName).getInputStream();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: org.wowtools/h2
/**
* Returns the input stream.
*
* @return the input stream
*/
@Override
public InputStream getBinaryStream() throws SQLException {
try {
debugCodeCall("getBinaryStream");
checkClosed();
return value.getInputStream();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.eventsourcing/h2
/**
* Returns the input stream.
*
* @return the input stream
*/
@Override
public InputStream getBinaryStream() throws SQLException {
try {
debugCodeCall("getBinaryStream");
checkClosed();
return value.getInputStream();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.eventsourcing/h2
/**
* Returns the value of the specified column as an input stream.
*
* @param columnLabel the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
@Override
public InputStream getBinaryStream(String columnLabel) throws SQLException {
try {
debugCodeCall("getBinaryStream", columnLabel);
return get(columnLabel).getInputStream();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.eventsourcing/h2
/**
* Returns the value of the specified column as an input stream.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
@Override
public InputStream getBinaryStream(int columnIndex) throws SQLException {
try {
debugCodeCall("getBinaryStream", columnIndex);
return get(columnIndex).getInputStream();
} catch (Exception e) {
throw logAndConvert(e);
}
}
代码示例来源:origin: com.eventsourcing/h2
/**
* Returns the length.
*
* @return the length
*/
@Override
public long length() throws SQLException {
try {
debugCodeCall("length");
checkClosed();
if (value.getType() == Value.BLOB) {
long precision = value.getPrecision();
if (precision > 0) {
return precision;
}
}
return IOUtils.copyAndCloseInput(value.getInputStream(), null);
} catch (Exception e) {
throw logAndConvert(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!