Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Service Bus
11g Release 1 (11.1.1.5.0)

E15033-03


com.bea.wli.sb.sources
Class StreamSource

java.lang.Object
  extended by com.bea.wli.sb.sources.StreamSource

All Implemented Interfaces:
SingleUseSource, Source

public class StreamSource
extends java.lang.Object
implements SingleUseSource

A byte-stream Source whose content comes from an InputStream. As a byte-stream source, the serialization methods do not heed any transformation options. NOTE: since this stream is backed by an InputStream, that means that this source is a single-use source. Both serialization methods pull from the same underlying InputStream, and once that content is consumed, it is gone. The push-based writeTo() method will result in all data being consumed immediately, assuming no error occurs. The pull-based getInputStream() actually gives the underlying InputStream directly to the caller.


Field Summary

 

Fields inherited from interface com.bea.wli.sb.sources.Source
DEFAULT_CHARACTER_SET_ENCODING

 

Constructor Summary
StreamSource(java.io.InputStream inputStream)
           

 

Method Summary
 java.io.InputStream getInputStream(TransformOptions options)
          Returns streaming byte-baseed representation of the Source's content.
 boolean isConsumed()
          Indicates if the Source has already been consumed
 int peek(byte[] b, int off, int len)
          Peek bytes from the input stream without consuming the input stream.
 void writeTo(java.io.OutputStream out, TransformOptions options)
          Serializes the Source's content to a byte-based stream.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

StreamSource

public StreamSource(java.io.InputStream inputStream)
Parameters:
inputStream - A valid InputStream reference to an XML stream.

Method Detail

getInputStream

public java.io.InputStream getInputStream(TransformOptions options)
Description copied from interface: Source
Returns streaming byte-baseed representation of the Source's content. The representation of that serialization is entirely up to the Source. Note that this method may involve an internal transformation, although it should not in any way change the underlying content.
Specified by:
getInputStream in interface Source
Parameters:
options - Options used to affect the serialization
Returns:
an InputStream for retrieving the serialized content

writeTo

public void writeTo(java.io.OutputStream out,
                    TransformOptions options)
             throws java.io.IOException
Description copied from interface: Source
Serializes the Source's content to a byte-based stream. The representation of that serialization is entirely up to the Source. The Source is forbidden from closing the provided OutputStream, although it is allowed to flush it. However, flushing the stream should be left to the caller, if possible. <p/> Note that this method may involve an internal transformation, although it should not in any way change the underlying content.
Specified by:
writeTo in interface Source
Parameters:
out - the OutputStream to which serialized content will be written
options - TransformOptions used to affect the serialization
Throws:
java.io.IOException

isConsumed

public boolean isConsumed()
Description copied from interface: SingleUseSource
Indicates if the Source has already been consumed
Specified by:
isConsumed in interface SingleUseSource
Returns:

peek

public int peek(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Peek bytes from the input stream without consuming the input stream. This does not affect subsequent calls to read
Parameters:
b - bytes array to copy bytes to
off - start offset for bytes to copy
len - length of bytes to copy
Returns:
number of copied bytes, -1 if no bytes are available or the stream is consumed.
Throws:
java.io.IOException - an I/O Exception occurred

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Service Bus
11g Release 1 (11.1.1.5.0)

E15033-03


Copyright © 2008, 2011, Oracle. All rights reserved.