/** * Generates output for requests that target media resources. */ public void generate(OutputStream contentStream, OutputProperties request, MediaMultipart source) throws IOException { OutputProperties prevProperties = null; try { prevProperties = GDataContentHandler.setThreadOutputProperties(request); source.writeTo(contentStream); } catch (MessagingException me) { // Unwrap basic I/O errors Throwable t = me.getCause(); if (t instanceof IOException) { throw (IOException) t; } // Wrap others based upon an invalid input entry IOException ioe = new IOException("Invalid multipart content"); ioe.initCause(new InvalidEntryException("Invalid media entry", me)); throw ioe; } finally { GDataContentHandler.setThreadOutputProperties(prevProperties); } } }
/** * Generates output for requests that target media resources. */ public void generate(OutputStream contentStream, OutputProperties request, MediaMultipart source) throws IOException { OutputProperties prevProperties = null; try { prevProperties = GDataContentHandler.setThreadOutputProperties(request); source.writeTo(contentStream); } catch (MessagingException me) { // Unwrap basic I/O errors Throwable t = me.getCause(); if (t instanceof IOException) { throw (IOException) t; } // Wrap others based upon an invalid input entry IOException ioe = new IOException("Invalid multipart content"); ioe.initCause(new InvalidEntryException("Invalid media entry", me)); throw ioe; } finally { GDataContentHandler.setThreadOutputProperties(prevProperties); } } }