Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc for Elexis version 2.1.7.dev vom 17.03.2013

ag.ion.bion.officelayer.internal.document
Class ByteArrayXInputStreamAdapter

java.lang.Object
  extended by com.sun.star.lib.uno.helper.WeakBase
      extended by com.sun.star.lib.uno.helper.ComponentBase
          extended by ag.ion.bion.officelayer.internal.document.ByteArrayXInputStreamAdapter
All Implemented Interfaces:
com.sun.star.io.XInputStream, com.sun.star.io.XSeekable, com.sun.star.lang.XComponent, com.sun.star.lang.XTypeProvider, com.sun.star.uno.XInterface, com.sun.star.uno.XWeak

public class ByteArrayXInputStreamAdapter
extends com.sun.star.lib.uno.helper.ComponentBase
implements com.sun.star.io.XInputStream, com.sun.star.io.XSeekable

Wrapper in order to use a byte array as a XInputStream interface. This class bases on the OpenOffice.org Java API class ByteArrayToXInputStreamAdapter.


Field Summary
 
Fields inherited from class com.sun.star.lib.uno.helper.ComponentBase
bDisposed, bInDispose, listenerContainer
 
Fields inherited from class com.sun.star.lib.uno.helper.WeakBase
_mapImplementationIds, _mapTypes
 
Fields inherited from interface com.sun.star.io.XInputStream
UNOTYPEINFO
 
Fields inherited from interface com.sun.star.io.XSeekable
UNOTYPEINFO
 
Fields inherited from interface com.sun.star.lang.XComponent
UNOTYPEINFO
 
Fields inherited from interface com.sun.star.uno.XWeak
UNOTYPEINFO
 
Fields inherited from interface com.sun.star.lang.XTypeProvider
UNOTYPEINFO
 
Constructor Summary
ByteArrayXInputStreamAdapter(byte[] bytes)
          Constructs new ByteArrayXInputStreamAdapter.
ByteArrayXInputStreamAdapter(java.io.InputStream inputStream, IOfficeProgressMonitor officeProgressMonitor)
          Constructs new ByteArrayXInputStreamAdapter.
ByteArrayXInputStreamAdapter(IOfficeProgressMonitor officeProgressMonitor, byte[] bytes)
          Constructs new ByteArrayXInputStreamAdapter.
 
Method Summary
 int available()
          Reads number of available bytes.
 void closeInput()
          Closes the stream.
 long getLength()
          Returns number of available bytes.
 long getPosition()
          Returns current position.
 int readBytes(byte[][] buffer, int size)
          Reads bytes from the stream.
 int readSomeBytes(byte[][] buffer, int size)
          Reads bytes from the stream.
 void seek(long position)
          Seeks position.
 void skipBytes(int size)
          Skips bytes.
 
Methods inherited from class com.sun.star.lib.uno.helper.ComponentBase
addEventListener, dispose, finalize, postDisposing, preDisposing, removeEventListener
 
Methods inherited from class com.sun.star.lib.uno.helper.WeakBase
getImplementationId, getTypes, queryAdapter
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayXInputStreamAdapter

public ByteArrayXInputStreamAdapter(java.io.InputStream inputStream,
                                    IOfficeProgressMonitor officeProgressMonitor)
                             throws java.io.IOException
Constructs new ByteArrayXInputStreamAdapter.

Parameters:
inputStream - input stream to be used
officeProgressMonitor - office progress monitor to be used
Throws:
java.io.IOException - if the input stream can not be read

ByteArrayXInputStreamAdapter

public ByteArrayXInputStreamAdapter(byte[] bytes)
                             throws java.lang.IllegalArgumentException
Constructs new ByteArrayXInputStreamAdapter.

Parameters:
bytes - bytes to be used
Throws:
java.lang.IllegalArgumentException - if the submitted bytes are not valid

ByteArrayXInputStreamAdapter

public ByteArrayXInputStreamAdapter(IOfficeProgressMonitor officeProgressMonitor,
                                    byte[] bytes)
                             throws java.lang.IllegalArgumentException
Constructs new ByteArrayXInputStreamAdapter.

Parameters:
officeProgressMonitor - office progress monitor to be used
bytes - bytes to be used
Throws:
java.lang.IllegalArgumentException - if the submitted bytes are not valid
Method Detail

available

public int available()
              throws com.sun.star.io.IOException
Reads number of available bytes.

Specified by:
available in interface com.sun.star.io.XInputStream
Returns:
number of available bytes
Throws:
com.sun.star.io.IOException - if any I/O related exception occurs

closeInput

public void closeInput()
                throws com.sun.star.io.IOException
Closes the stream.

Specified by:
closeInput in interface com.sun.star.io.XInputStream
Throws:
com.sun.star.io.IOException - if any I/O related exception occurs

readBytes

public int readBytes(byte[][] buffer,
                     int size)
              throws com.sun.star.io.BufferSizeExceededException,
                     com.sun.star.io.IOException
Reads bytes from the stream.

Specified by:
readBytes in interface com.sun.star.io.XInputStream
Parameters:
buffer - byte array to be used
size - number of bytes to be fetched
Returns:
number of fetched bytes
Throws:
com.sun.star.io.BufferSizeExceededException - if the buffer size was exceeded
com.sun.star.io.IOException - if any I/O related exception occurs

readSomeBytes

public int readSomeBytes(byte[][] buffer,
                         int size)
                  throws com.sun.star.io.BufferSizeExceededException,
                         com.sun.star.io.IOException
Reads bytes from the stream.

Specified by:
readSomeBytes in interface com.sun.star.io.XInputStream
Parameters:
buffer - byte array to be used
size - number of bytes to be fetched
Returns:
number of fetched bytes
Throws:
com.sun.star.io.BufferSizeExceededException - if the buffer size was exceeded
com.sun.star.io.IOException - if any I/O related exception occurs

skipBytes

public void skipBytes(int size)
               throws com.sun.star.io.BufferSizeExceededException,
                      com.sun.star.io.IOException
Skips bytes.

Specified by:
skipBytes in interface com.sun.star.io.XInputStream
Parameters:
size - number of bytes to be skipped
Throws:
com.sun.star.io.BufferSizeExceededException - if the buffer size was exceeded
com.sun.star.io.IOException - if any I/O related exception occurs

getLength

public long getLength()
               throws com.sun.star.io.IOException
Returns number of available bytes.

Specified by:
getLength in interface com.sun.star.io.XSeekable
Returns:
number of available bytes
Throws:
com.sun.star.io.IOException - if any I/O related exception occurs

getPosition

public long getPosition()
                 throws com.sun.star.io.IOException
Returns current position.

Specified by:
getPosition in interface com.sun.star.io.XSeekable
Returns:
current position
Throws:
com.sun.star.io.IOException - if any I/O related exception occurs

seek

public void seek(long position)
          throws com.sun.star.lang.IllegalArgumentException,
                 com.sun.star.io.IOException
Seeks position.

Specified by:
seek in interface com.sun.star.io.XSeekable
Parameters:
position - position to be used
Throws:
com.sun.star.lang.IllegalArgumentException - if the seek position is invalid
com.sun.star.io.IOException - if any I/O related exception occurs

Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc for Elexis version 2.1.7.dev vom 17.03.2013