本文整理汇总了Java中org.richfaces.model.UploadItem.getData方法的典型用法代码示例。如果您正苦于以下问题:Java UploadItem.getData方法的具体用法?Java UploadItem.getData怎么用?Java UploadItem.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.richfaces.model.UploadItem
的用法示例。
在下文中一共展示了UploadItem.getData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReadAvailableLanguages
import org.richfaces.model.UploadItem; //导入方法依赖的package包/类
public void onReadAvailableLanguages(ActionEvent event) throws IOException {
this.availableLanguages.clear();
for (UploadItem item : this.uploadedConcepts) {
byte[] fileData;
if (item.isTempFile()) {
fileData = FileUtils.readFileToByteArray(item.getFile());
} else {
fileData = item.getData();
}
String xml = new String(fileData);
String[] languages = metaDataFacade.getLanguagesAvailableForImport(
xml);
for (String lang : languages) {
lang = lang.replaceAll("-", "_");
Locale locale = LocaleUtils.toLocale(lang);
this.availableLanguages.put(locale.getDisplayLanguage(), lang);
}
}
}
示例2: onImport
import org.richfaces.model.UploadItem; //导入方法依赖的package包/类
/**
* Event handler for importing the uploaded subject files.
*
* @param event Event that invoked the handler
* @throws IOException If any of the uploaded files could not be read
*/
public void onImport(ActionEvent event) throws IOException {
int imported = 0;
for (UploadItem item : this.uploadedConcepts) {
byte[] fileData;
if (item.isTempFile()) {
fileData = FileUtils.readFileToByteArray(item.getFile());
} else {
fileData = item.getData();
}
String xml = new String(fileData);
if (getImportLanguage() != null) {
imported += metaDataFacade.importKnowledgeItem(xml,
getImportLanguage());
}
}
JsfUtils.createMessage("frmSubjects", FacesMessage.SEVERITY_INFO, Bundle.i18n.name(),
"Concepts_X_SUBJECTS_IMPORTED", new Object[]{imported});
}
示例3: carregaFoto
import org.richfaces.model.UploadItem; //导入方法依赖的package包/类
public void carregaFoto(UploadEvent event) throws Exception {
UploadItem item = event.getUploadItem();
foto = new Foto();
foto.setTamanho(item.getData().length);
foto.setArquivo(item.getFileName());
foto.setDados(item.getData());
ImageIcon temp = new ImageIcon(item.getData());
foto.setLargura(temp.getIconWidth());
foto.setAltura(temp.getIconHeight());
listaFoto.add(foto);
contaArquivos--;
}
示例4: attachQuestionImage
import org.richfaces.model.UploadItem; //导入方法依赖的package包/类
/**
* @param editQuestion
* @param uploadItem
* @throws IOException
*/
protected void attachQuestionImage(QuestionVO editQuestion, UploadItem uploadItem) throws IOException {
byte[] imgBytes = uploadItem.getData();
ByteArrayInputStream inputStream = new ByteArrayInputStream(imgBytes);
BufferedImage bufferedImage = ImageIO.read(inputStream);
List<ImageVO> images = editQuestion.getImageVOs();
ImageVO imageVO = new ImageVO();
imageVO.setImage(bufferedImage);
images.add(imageVO);
}