本文整理汇总了Java中org.hsqldb.lib.InputStreamWrapper类的典型用法代码示例。如果您正苦于以下问题:Java InputStreamWrapper类的具体用法?Java InputStreamWrapper怎么用?Java InputStreamWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InputStreamWrapper类属于org.hsqldb.lib包,在下文中一共展示了InputStreamWrapper类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TarEntrySupplicant
import org.hsqldb.lib.InputStreamWrapper; //导入依赖的package包/类
/**
* After instantiating a TarEntrySupplicant, the user must either invoke
* write() or close(), to release system resources on the input
* File/Stream.
*/
public TarEntrySupplicant(String path, File file,
TarFileOutputStream tarStream,
long paxThreshold)
throws FileNotFoundException, TarMalformatException {
// Must use an expression-embedded ternary here to satisfy compiler
// that this() call be first statement in constructor.
this(((path == null)
? file.getPath()
: path), '0', tarStream, paxThreshold);
// Difficult call for '0'. binary 0 and character '0' both mean
// regular file. Binary 0 pre-UStar is probably more portable,
// but we are writing a valid UStar header, and I doubt anybody's
// tar implementation would choke on this since there is no
// outcry of UStar archives failing to work with older tars.
if (!file.isFile()) {
throw new IllegalArgumentException(
RB.nonfile_entry.getString());
}
if (!file.canRead()) {
throw new IllegalArgumentException(
RB.read_denied.getString(file.getAbsolutePath()));
}
modTime = file.lastModified() / 1000L;
fileMode = TarEntrySupplicant.getLameMode(file);
dataSize = file.length();
inputStream = new InputStreamWrapper(new FileInputStream(file));
}
示例2: writeAsFiles
import org.hsqldb.lib.InputStreamWrapper; //导入依赖的package包/类
public void writeAsFiles() throws IOException {
int bufferSize = 512
* DbBackup.generateBufferBlockValue(componentFiles);
byte[] writeBuffer = new byte[bufferSize];
checkEssentialFiles();
FileOutputStream fileOut = null;
for (int i = 0; i < componentFiles.length; i++) try {
if (ignoreList[i]) {
continue;
}
if (!componentFiles[i].exists()) {
continue;
}
File outFile = new File(archiveFile, componentFiles[i].getName());
fileOut = new FileOutputStream(outFile);
if (componentStreams[i] == null) {
componentStreams[i] = new InputStreamWrapper(
new FileInputStream(componentFiles[i]));
}
InputStreamInterface instream = componentStreams[i];
while (true) {
int count = instream.read(writeBuffer, 0, writeBuffer.length);
if (count <= 0) {
break;
}
fileOut.write(writeBuffer, 0, count);
}
instream.close();
fileOut.flush();
fileOut.getFD().sync();
} finally {
if (fileOut != null) {
fileOut.close();
fileOut = null;
}
}
}