public void dispose() { out.dispose(); } }
public InputStream getInputStream() throws IOException { return cos.getInputStream(); }
public File getFile() { return cos.getTempFile(); } }
public InputStream createInputStream() throws XFireException { try { // TODO: its really not necessary to cache this... out = new CachedOutputStream(1024*1000, null); XMLStreamWriter writer = STAXUtils.createXMLStreamWriter(out, msg.getEncoding(), context); msg.setProperty(Channel.OUTPUTSTREAM, out); msg.getSerializer().writeMessage(msg, writer, context); writer.flush(); writer.close(); out.close(); return out.getInputStream(); } catch (XMLStreamException e) { throw new XFireException("Couldn't send message.", e); } catch (IOException e) { throw new XFireException("Couldn't send message.", e); } }
public void write(byte[] b, int off, int len) throws IOException { this.totalLength += len; if (inmem && totalLength > threshold) switchToFile(); currentStream.write(b, off, len); }
public CachedOutputStream(int threshold, File outputDir) throws IOException { this.threshold = threshold; this.outputDir = outputDir; if (threshold <= 0) { createFileOutputStream(); } else { currentStream = new ByteArrayOutputStream(); inmem = true; } }
final CachedOutputStream cos = new CachedOutputStream(getThreshold(), getTempDirectory());
public void write(int b) throws IOException { this.totalLength++; if (inmem && totalLength > threshold) switchToFile(); currentStream.write(b); }
private void switchToFile() throws IOException { byte[] bytes = ((ByteArrayOutputStream) currentStream).toByteArray(); createFileOutputStream(); currentStream.write(bytes); inmem = false; }
public void write(byte[] b) throws IOException { this.totalLength += b.length; if (inmem && totalLength > threshold) switchToFile(); currentStream.write(b); }
public void dispose() { for (Iterator itr = cache.iterator(); itr.hasNext();) { CachedOutputStream cos = (CachedOutputStream) itr.next(); cos.dispose(); } }