本文整理汇总了Java中org.apache.struts.upload.FormFile.getInputStream方法的典型用法代码示例。如果您正苦于以下问题:Java FormFile.getInputStream方法的具体用法?Java FormFile.getInputStream怎么用?Java FormFile.getInputStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.struts.upload.FormFile
的用法示例。
在下文中一共展示了FormFile.getInputStream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseGroupSpreadsheet
import org.apache.struts.upload.FormFile; //导入方法依赖的package包/类
public int parseGroupSpreadsheet(FormFile fileItem, Long groupingID, Map<String, Set<String>> groups)
throws IOException {
POIFSFileSystem fs = new POIFSFileSystem(fileItem.getInputStream());
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
int startRow = sheet.getFirstRowNum();
int endRow = sheet.getLastRowNum();
int skipped = 0;
for (int i = startRow + 1; i < (endRow + 1); i++) {
HSSFRow row = sheet.getRow(i);
String login = parseStringCell(row.getCell(0));
if (login != null) {
login = login.trim();
if (login.length() > 0) {
String groupName = row.getLastCellNum() > 3 ? parseStringCell(row.getCell(3)) : null;
groupName = groupName != null ? groupName.trim() : null;
if (groupName == null || groupName.length() == 0) {
skipped++;
GroupingUploadAJAXAction.log.warn("Unable to add learner " + login
+ " for group in related to grouping " + groupingID + " as group name is missing.");
} else {
Set<String> users = groups.get(groupName);
if (users == null) {
users = new HashSet<String>();
groups.put(groupName, users);
}
users.add(login);
}
}
}
}
return skipped;
}
示例2: getSheet
import org.apache.struts.upload.FormFile; //导入方法依赖的package包/类
private HSSFSheet getSheet(FormFile fileItem) throws IOException {
POIFSFileSystem fs = new POIFSFileSystem(fileItem.getInputStream());
HSSFWorkbook wb = new HSSFWorkbook(fs);
return wb.getSheetAt(0);
}