Skip navigation links

Oracle® Multimedia Java API Reference
12c Release 1 (12.1)

E17699-06


oracle.ord.media.jai.io
Class SeekableOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by oracle.ord.media.jai.io.SeekableOutputStream

All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Direct Known Subclasses:
BlobOutputStream, ByteArraySeekableOutputStream, FileSeekableOutputStream, MemoryCacheSeekableOutputStream

public abstract class SeekableOutputStream
extends java.io.OutputStream

The SeekableOutputStream abstract class describes OutputStream objects that are seekable.

In order to use JAI with Oracle Multimedia JAI stream objects, you will need to import classes from the oracle.ord.media.jai.io package into your Java file.

All methods except the close method will throw an IOException error if they are called on a stream that is already closed. Calling the close method on a stream that is already closed will have no effect.


Constructor Summary
SeekableOutputStream()
           

 

Method Summary
abstract  long getFilePointer()
          Returns the offset in the stream.
abstract  long length()
          Returns the current length of the stream.
abstract  void seek(long pos)
          Sets the file-pointer offset, measured from the beginning of this stream, at which the next write operation will occur.
abstract  void truncate(long len)
          Truncates the stream to the specified length.
static SeekableOutputStream wrapOutputStream(java.io.OutputStream os)
          Returns a SeekableOutputStream object that will write to a specified OutputStream object.

 

Methods inherited from class java.io.OutputStream
close, flush, write, write, write

 

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

 

Constructor Detail

SeekableOutputStream

public SeekableOutputStream()

Method Detail

length

public abstract long length()
                     throws java.io.IOException
Returns the current length of the stream.
Throws:
java.io.IOException - if an IO error occurs.

getFilePointer

public abstract long getFilePointer()
                             throws java.io.IOException
Returns the offset in the stream.
Throws:
java.io.IOException - if an IO error occurs.

seek

public abstract void seek(long pos)
                   throws java.io.IOException
Sets the file-pointer offset, measured from the beginning of this stream, at which the next write operation will occur.

The offset may be set beyond the end of the stream. Setting the offset beyond the end of the stream does not change the stream length; the stream length will change only by writing after the offset has been set beyond the end of the stream.

Parameters:
pos - the offset position, measured in bytes from the beginning of the stream, at which to set the file pointer.
Throws:
java.io.IOException - if the value of the pos parameter is less than zero or if an IO error occurs.

truncate

public abstract void truncate(long len)
                       throws java.io.IOException
Truncates the stream to the specified length.
Parameters:
len - the length of the stream, in bytes.
Throws:
java.io.IOException - if the value of the len parameter is less than zero or larger than the stream length, or if an IO error occurs.

wrapOutputStream

public static SeekableOutputStream wrapOutputStream(java.io.OutputStream os)
                                             throws java.io.IOException
Returns a SeekableOutputStream object that will write to a specified OutputStream object. If the specified OutputStream object is not empty, subsequent write operations will append to the existing bytes in the OutputStream object. Currently, for a generic output stream, the SeekableOutputStream object that is returned is a MemoryCacheSeekableOutputStream object. To avoid the restrictions in the MemoryCacheSeekableOutputStream class, use the SeekableOutputStream subclasses, such as BlobOutputStream, FileSeekableOutputStream, and ByteArraySeekableOutputStream, if possible.

See the MemoryCacheSeekableOutputStream class for information about restrictions and implementation details for the class.

Parameters:
os - an OutputStream object.
Returns:
an instance of the SeekableOutputStream class.
Throws:
java.io.IOException - if an IO error occurs.

Skip navigation links

Oracle® Multimedia Java API Reference
12c Release 1 (12.1)

E17699-06


Copyright © 1999, 2013, Oracle and/or its affiliates. All rights reserved.