Holger's
Java API

com.antelmann.ooffice
Class OOInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ByteArrayInputStream
          extended by com.antelmann.ooffice.OOInputStream
All Implemented Interfaces:
com.sun.star.io.XInputStream, com.sun.star.io.XSeekable, com.sun.star.io.XSeekableInputStream, com.sun.star.uno.XInterface, Closeable

public class OOInputStream
extends ByteArrayInputStream
implements com.sun.star.io.XSeekableInputStream

a bridge from java.io.InputStream to XInputStream, which - in reality - must also implement XSeekable. This code is based on public domain sources from the web

Since:
21.02.2009, 19:08:39
Author:
Holger Antelmann

Field Summary
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Fields inherited from interface com.sun.star.io.XInputStream
UNOTYPEINFO
 
Fields inherited from interface com.sun.star.io.XSeekable
UNOTYPEINFO
 
Constructor Summary
OOInputStream(byte[] buf)
           
OOInputStream(InputStream in)
           
 
Method Summary
 void closeInput()
           
 long getLength()
           
 long getPosition()
           
 int readBytes(byte[][] buffer, int bufferSize)
           
 int readSomeBytes(byte[][] buffer, int bufferSize)
           
 void seek(long position)
           
 void skipBytes(int skipLength)
           
 void streamTo(OutputStream out)
           
 
Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.star.io.XInputStream
available
 

Constructor Detail

OOInputStream

public OOInputStream(InputStream in)
              throws IOException
Throws:
IOException

OOInputStream

public OOInputStream(byte[] buf)
Method Detail

streamTo

public void streamTo(OutputStream out)
              throws IOException
Throws:
IOException

readBytes

public int readBytes(byte[][] buffer,
                     int bufferSize)
              throws com.sun.star.io.NotConnectedException,
                     com.sun.star.io.BufferSizeExceededException,
                     com.sun.star.io.IOException
Specified by:
readBytes in interface com.sun.star.io.XInputStream
Throws:
com.sun.star.io.NotConnectedException
com.sun.star.io.BufferSizeExceededException
com.sun.star.io.IOException

readSomeBytes

public int readSomeBytes(byte[][] buffer,
                         int bufferSize)
                  throws com.sun.star.io.NotConnectedException,
                         com.sun.star.io.BufferSizeExceededException,
                         com.sun.star.io.IOException
Specified by:
readSomeBytes in interface com.sun.star.io.XInputStream
Throws:
com.sun.star.io.NotConnectedException
com.sun.star.io.BufferSizeExceededException
com.sun.star.io.IOException

skipBytes

public void skipBytes(int skipLength)
               throws com.sun.star.io.NotConnectedException,
                      com.sun.star.io.BufferSizeExceededException,
                      com.sun.star.io.IOException
Specified by:
skipBytes in interface com.sun.star.io.XInputStream
Throws:
com.sun.star.io.NotConnectedException
com.sun.star.io.BufferSizeExceededException
com.sun.star.io.IOException

closeInput

public void closeInput()
                throws com.sun.star.io.NotConnectedException,
                       com.sun.star.io.IOException
Specified by:
closeInput in interface com.sun.star.io.XInputStream
Throws:
com.sun.star.io.NotConnectedException
com.sun.star.io.IOException

getLength

public long getLength()
               throws com.sun.star.io.IOException
Specified by:
getLength in interface com.sun.star.io.XSeekable
Throws:
com.sun.star.io.IOException

getPosition

public long getPosition()
                 throws com.sun.star.io.IOException
Specified by:
getPosition in interface com.sun.star.io.XSeekable
Throws:
com.sun.star.io.IOException

seek

public void seek(long position)
          throws com.sun.star.lang.IllegalArgumentException,
                 com.sun.star.io.IOException
Specified by:
seek in interface com.sun.star.io.XSeekable
Throws:
com.sun.star.lang.IllegalArgumentException
com.sun.star.io.IOException


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads