com.ibm.rational.test.lt.testgen.core.store
Class ConvertedAttachmentOutputStream
java.lang.Object
java.io.OutputStream
com.ibm.rational.test.lt.testgen.core.store.ConvertedAttachmentOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class ConvertedAttachmentOutputStream
- extends OutputStream
An output stream returned by an IConvertedPacketAttachment
. Besides output stream
regular features, this output stream allows the caller to write a complete or a part
of an existing attachment. These additional write methods are more efficient than
a byte-to-byte copy between two streams.
Method Summary |
void |
close()
|
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
void |
write(IPacketAttachment attachment)
Writes the content of an attachment to the receiver. |
void |
write(IPacketAttachment attachment,
InputStream inputStream)
Writes the content of an input stream, starting at the stream current position, till
the end of stream is reached. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConvertedAttachmentOutputStream
public ConvertedAttachmentOutputStream(com.ibm.rational.test.lt.testgen.core.internal.store.TemporaryAttachment attachment)
write
public void write(int b)
throws IOException
- Specified by:
write
in class OutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write
in class OutputStream
- Throws:
IOException
write
public void write(byte[] b)
throws IOException
- Overrides:
write
in class OutputStream
- Throws:
IOException
write
public void write(IPacketAttachment attachment)
throws IOException
- Writes the content of an attachment to the receiver. The original content is referenced
rather than copied, so this method is much more efficient than a loop reading bytes from the
original attachment and writing them to the receiver.
- Parameters:
attachment
- A packet attachment.
- Throws:
IOException
- Any exception thrown by the I/O layer.
write
public void write(IPacketAttachment attachment,
InputStream inputStream)
throws IOException
- Writes the content of an input stream, starting at the stream current position, till
the end of stream is reached.
- Parameters:
attachment
- If applicable, the attachment that the input stream was created from.
If this argument is null
, the stream will be copied. If this argument is non
null, it must be the attachment that was used to create inputStream
; in this
case, the attachment content will be referenced rather than copied.inputStream
- An input stream. The remaining data in the input stream will be
read and written to the receiver.
- Throws:
IOException
- Any exception thrown by the I/O layer.
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class OutputStream
- Throws:
IOException
© Copyright IBM Corp. 2012. All rights reserved.