diff options
Diffstat (limited to 'scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java b/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java index a1e27793f4f1..8da2bb27ff1b 100644 --- a/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java +++ b/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java @@ -28,69 +28,59 @@ public class XInputStreamWrapper extends InputStream { } @Override - public int read() throws java.io.IOException - { + public int read() throws java.io.IOException { byte[][] byteRet = new byte[1][0]; long numRead; try { numRead = m_xInputStream.readBytes(byteRet, 1); - } - catch (com.sun.star.io.IOException ioe) { + } catch (com.sun.star.io.IOException ioe) { throw new java.io.IOException(ioe.getMessage()); } if (numRead != 1) { return -1; } + return byteRet[0][0]; } @Override - public int read( byte[] b ) throws java.io.IOException - { + public int read(byte[] b) throws java.io.IOException { byte[][] byteRet = new byte[1][]; byteRet[0] = b; - try - { - return m_xInputStream.readBytes( byteRet, b.length ); - } - catch ( com.sun.star.io.IOException ioe) - { + + try { + return m_xInputStream.readBytes(byteRet, b.length); + } catch (com.sun.star.io.IOException ioe) { throw new java.io.IOException(ioe.getMessage()); } } @Override - public long skip(long n) throws java.io.IOException - { + public long skip(long n) throws java.io.IOException { try { m_xInputStream.skipBytes((int)n); return n; - } - catch (com.sun.star.io.IOException ioe) { + } catch (com.sun.star.io.IOException ioe) { throw new java.io.IOException(ioe.getMessage()); } } @Override - public int available() throws java.io.IOException - { + public int available() throws java.io.IOException { try { return m_xInputStream.available(); - } - catch (com.sun.star.io.IOException ioe) { + } catch (com.sun.star.io.IOException ioe) { throw new java.io.IOException(ioe.getMessage()); } } @Override - public void close() throws java.io.IOException - { + public void close() throws java.io.IOException { try { m_xInputStream.closeInput(); - } - catch (com.sun.star.io.IOException ioe) { + } catch (com.sun.star.io.IOException ioe) { throw new java.io.IOException(ioe.getMessage()); } } |