Ola galera !! gostaria de saber se é possivel retornar dois parametros em um método por exemplo…
chamada do método
responseVO.setArquivoRetorno(downloadarquivo(source, requestVO));
método
private String downloadarquivo(String source, FT17RequestVO requestVO)throws HandleException {
FT17ResponseVO responseVO = new FT17ResponseVO();
String arquivo = "";
try {
LocalFileUtil fileUtil = new LocalFileUtil(source);
List<File> files = fileUtil.getFiles("");
byte[] buf = new byte[1024];
int len = 0;
log.info("Generating FT17 download of object");
for (File file : files) {
InputStream in = null;
ByteArrayOutputStream out = null;
try {
in = new FileInputStream(file);
out = new ByteArrayOutputStream();
if (file.getName().contains(requestVO.getNomeArquivo())) {
len = in.read(buf);
out.write(buf, 0, len);
out.flush();
// arquivo convertido para base 64
arquivo = Base64.encode(out.toByteArray());
responseVO.setCodigoRetorno(0);
}
} catch (Exception e) {
log.warn("Fail to download file " + file.getName()
+ " in responseVO", e);
responseVO.setCodigoRetorno(1);
} finally {
try {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
} catch (IOException e) {
log.warn(
"Fail to close streams for file "
+ file.getName(), e);
responseVO.setCodigoRetorno(1);
}
}
}
} catch (IntegLayerException e) {
throw new HandleException(
IntegLayerErrorCodes.ERROR_BUILDING_RESPONSE, e);
}
return arquivo;
return responseVO; //é possivel fazer algo assim ??retornar os dois parametros ""responseVO" e "arquivo"
}
vlw obrigado
