Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AllegatiReader implements ResourceAwareItemReaderItemStream<Allegato> {
- @PersistenceContext
- protected EntityManager em;
- private Resource resource;
- @Override
- public void close() throws ItemStreamException {
- }
- @Override
- public void open(ExecutionContext arg0) throws ItemStreamException {
- }
- @Override
- public void update(ExecutionContext arg0) throws ItemStreamException {
- }
- @Override
- public Allegato read() throws Exception, UnexpectedInputException,
- ParseException, NonTransientResourceException {
- // DO SOMETHING ...
- byte[] fileContent = new byte[(int) resource.getFile().length()];
- resource.getInputStream().read(fileContent);
- resource.getInputStream().close();
- allegato.getFile().setFile(fileContent);
- return allegato;
- }
- @Override
- public void setResource(Resource arg0) {
- this.resource = arg0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement