diff options
Diffstat (limited to 'scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java | 156 |
1 files changed, 69 insertions, 87 deletions
diff --git a/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java b/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java index b1c663c54a7c..1d54b136811f 100644 --- a/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java +++ b/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java @@ -21,101 +21,83 @@ import com.sun.star.io.XOutputStream; public class XOutputStreamWrapper extends OutputStream { - private XOutputStream m_xOutputStream; - public XOutputStreamWrapper(XOutputStream xOs ) { - this.m_xOutputStream = xOs; + private XOutputStream m_xOutputStream; + public XOutputStreamWrapper(XOutputStream xOs) { + this.m_xOutputStream = xOs; + } + @Override + public void write(int b) + throws java.io.IOException { + if (m_xOutputStream == null) { + throw new java.io.IOException("Stream is null"); + } + + byte[] bytes = new byte[1]; + bytes[0] = (byte) b; + + try { + m_xOutputStream.writeBytes(bytes); + } catch (com.sun.star.io.IOException ioe) { + throw new java.io.IOException(ioe.getMessage()); + } + } + @Override + public void write(byte[] b) + throws java.io.IOException { + + if (m_xOutputStream == null) { + throw new java.io.IOException("Stream is null"); + } + + try { + m_xOutputStream.writeBytes(b); + } catch (com.sun.star.io.IOException ioe) { + throw new java.io.IOException(ioe.getMessage()); } - @Override - public void write(int b) - throws java.io.IOException - { - if ( m_xOutputStream == null ) - { - throw new java.io.IOException("Stream is null"); - } - byte[] bytes = new byte[1]; - bytes[0] = (byte) b; - try - { - m_xOutputStream.writeBytes( bytes ); - } - catch ( com.sun.star.io.IOException ioe ) - { - throw new java.io.IOException(ioe.getMessage()); - } + } + @Override + public void write(byte[] b, int off, int len) + throws java.io.IOException { + if (m_xOutputStream == null) { + throw new java.io.IOException("Stream is null"); } - @Override - public void write(byte[] b) - throws java.io.IOException - { - if ( m_xOutputStream == null ) - { - throw new java.io.IOException( "Stream is null" ); - } - try - { - m_xOutputStream.writeBytes( b ); - } - catch ( com.sun.star.io.IOException ioe ) - { - throw new java.io.IOException(ioe.getMessage()); - } + byte[] bytes = new byte[len]; + System.arraycopy(b, off, bytes, 0, len); + + try { + m_xOutputStream.writeBytes(bytes); + } catch (com.sun.star.io.IOException ioe) { + throw new java.io.IOException(ioe.getMessage()); } - @Override - public void write( byte[] b, int off, int len ) - throws java.io.IOException - { - if ( m_xOutputStream == null ) - { - throw new java.io.IOException( "Stream is null" ); - } - byte[] bytes = new byte[len]; - System.arraycopy(b, off, bytes, 0, len); - try - { - m_xOutputStream.writeBytes(bytes); - } - catch ( com.sun.star.io.IOException ioe ) - { - throw new java.io.IOException(ioe.getMessage()); - } + } + + @Override + public void flush() + throws java.io.IOException { + if (m_xOutputStream == null) { + throw new java.io.IOException("Stream is null"); } - @Override - public void flush() - throws java.io.IOException - { - if ( m_xOutputStream == null ) - { - throw new java.io.IOException( "Stream is null" ); - } - try - { - m_xOutputStream.flush(); - } - catch ( com.sun.star.io.IOException ioe ) - { - throw new java.io.IOException(ioe.getMessage()); - } + try { + m_xOutputStream.flush(); + } catch (com.sun.star.io.IOException ioe) { + throw new java.io.IOException(ioe.getMessage()); } - @Override - public void close() - throws java.io.IOException - { - if ( m_xOutputStream == null ) - { - throw new java.io.IOException( "Stream is null" ); - } - try - { - m_xOutputStream.closeOutput(); - } - catch ( com.sun.star.io.IOException ioe ) - { - throw new java.io.IOException(ioe.getMessage()); - } + } + @Override + public void close() + throws java.io.IOException { + if (m_xOutputStream == null) { + throw new java.io.IOException("Stream is null"); } + try { + m_xOutputStream.closeOutput(); + } catch (com.sun.star.io.IOException ioe) { + throw new java.io.IOException(ioe.getMessage()); + } } +} + |