public byte[] getBytesForFileName(String filename) throws Exception {
if (Utils.isEmpty(filename)) {
throw new IllegalArgumentException("File name cannot be null");
}
byte[] fileContent = null;
ByteArrayInputStream bis = new ByteArrayInputStream(getUnpackagedZipFileAsBytes());
ZipInputStream zis = new ZipInputStream(bis);
try {
for (;;) {
ZipEntry ze = zis.getNextEntry();
if (ze == null) {
break;
}
fileContent = StreamUtils.getBytes(zis);
String name = ze.getName();
if (ze.isDirectory()) {
continue;
}
if (filename.endsWith(name)) {
if (logger.isDebugEnabled()) {
logger.debug("Found '" + name + "' body size [" + fileContent.length + "]");
}
return fileContent;
}
}
} finally {
zis.close();
}
return fileContent;
}
BaseIDETestCase.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:idecore
作者:
评论列表
文章目录