本文整理汇总了Java中org.apache.poi.poifs.filesystem.DocumentInputStream类的典型用法代码示例。如果您正苦于以下问题:Java DocumentInputStream类的具体用法?Java DocumentInputStream怎么用?Java DocumentInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DocumentInputStream类属于org.apache.poi.poifs.filesystem包,在下文中一共展示了DocumentInputStream类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sanitizeSummaryInformation
import org.apache.poi.poifs.filesystem.DocumentInputStream; //导入依赖的package包/类
protected void sanitizeSummaryInformation(BleachSession session, DocumentEntry dsiEntry) {
try (DocumentInputStream dis = new DocumentInputStream(dsiEntry)) {
PropertySet ps = new PropertySet(dis);
// Useful for debugging purposes
// LOGGER.debug("PropertySet sections: {}", ps.getSections());
SummaryInformation dsi = new SummaryInformation(ps);
sanitizeSummaryInformation(session, dsi);
} catch (NoPropertySetStreamException | UnexpectedPropertySetTypeException | MarkUnsupportedException | IOException e) {
LOGGER.error("An error occured while trying to sanitize the document entry", e);
}
}
示例2: setByteArrayInputStream
import org.apache.poi.poifs.filesystem.DocumentInputStream; //导入依赖的package包/类
/**
* 압축된 스트림을 읽어 압축을 풀어서 압축 풀린 데이터로 InputStream을 만든다.
*
* @param de
* 스트림을 가리키는 Apache POI 객체
* @throws Exception
*/
private void setByteArrayInputStream(DocumentEntry de) throws Exception {
DocumentInputStream dis = new DocumentInputStream(de);
byte[] compressed = getCompressedBytes(dis, de.getSize());
dis.close();
byte[] decompressed = decompress(compressed);
bis = new ByteArrayInputStream(decompressed);
setSize(decompressed.length);
}
示例3: checkCompoundStorage
import org.apache.poi.poifs.filesystem.DocumentInputStream; //导入依赖的package包/类
private static void checkCompoundStorage(OleBlob.CompoundContent cc,
Attachment attach)
throws Exception
{
File tmpData = File.createTempFile("attach_", ".dat");
try {
FileOutputStream fout = new FileOutputStream(tmpData);
fout.write(attach.getFileData());
fout.close();
NPOIFSFileSystem attachFs = new NPOIFSFileSystem(tmpData, true);
for(OleBlob.CompoundContent.Entry e : cc) {
DocumentEntry attachE = null;
try {
attachE = CompoundOleUtil.getDocumentEntry(e.getName(), attachFs.getRoot());
} catch(FileNotFoundException fnfe) {
// ignored, the ole data has extra entries
continue;
}
byte[] attachEBytes = toByteArray(new DocumentInputStream(attachE),
attachE.getSize());
byte[] entryBytes = toByteArray(e.getStream(), e.length());
assertTrue(Arrays.equals(attachEBytes, entryBytes));
}
ByteUtil.closeQuietly(attachFs);
} finally {
tmpData.delete();
}
}
示例4: getStream
import org.apache.poi.poifs.filesystem.DocumentInputStream; //导入依赖的package包/类
public InputStream getStream() throws IOException {
return new DocumentInputStream(_docEntry);
}
示例5: StreamReaderForNormal
import org.apache.poi.poifs.filesystem.DocumentInputStream; //导入依赖的package包/类
/**
* 생성자
*
* @param de
* 스트림을 가리키는 Apache POI 객체
* @param fileVersion
* @throws IOException
*/
public StreamReaderForNormal(DocumentEntry de, FileVersion fileVersion)
throws IOException {
super();
dis = new DocumentInputStream(de);
setSize(de.getSize());
setFileVersion(fileVersion);
}
示例6: getCompressedBytes
import org.apache.poi.poifs.filesystem.DocumentInputStream; //导入依赖的package包/类
/**
* 스트림에서 압축된 데이터를 읽는다.
*
* @param dis
* 스트림을 읽기 위한 Apache POI InputStream 객체
* @param size
* 읽을 크기
* @return 압축된 데이터
* @throws IOException
*/
private byte[] getCompressedBytes(DocumentInputStream dis, int size)
throws IOException {
byte[] buffer = new byte[size];
dis.read(buffer);
return buffer;
}