Skip navigation links

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

E17699-06


oracle.ord.media.io
Interface SeekableInputStream

All Known Implementing Classes:
BfileInputStream, BlobInputStream, FileSeekableInputStream

public interface SeekableInputStream

An interface describing an input stream that is seekable.


Method Summary
 void close()
          Closes the input stream and releases any resources associated with this stream.
 long getFilePointer()
          Returns the current offset in this stream.
 int read()
          Reads a single byte from the stream.
 int read(byte[] b)
          Reads up to the specified number of bytes from the stream into the specified byte array of specified length.
 int read(byte[] b, int off, int len)
          Reads up to the specified number of bytes from the stream into the specified byte array starting at the starting position for the offset.
 void seek(long pos)
          Sets the file-pointer offset, measured from the beginning of the stream, at which the next read will occur.
 long skip(long n)
          Attempts to skip over the specified number of bytes of input.

 

Method Detail

getFilePointer

long getFilePointer()
                    throws java.lang.Exception
Returns the current offset in this stream.
Returns:
the offset, in bytes, from the beginning of the stream at which the next read will occur.
Throws:
java.lang.Exception - if an IO error occurs.

seek

void seek(long pos)
          throws java.lang.Exception
Sets the file-pointer offset, measured from the beginning of the stream, at which the next read will occur. The offset may be 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.lang.Exception - if the value of the pos parameter is less than zero or if an IO error occurs.

read

int read()
         throws java.lang.Exception
Reads a single byte from the stream.
Returns:
the next byte of data as an integer (int) in the range of 0 to 255, or -1 if the end of the stream has been reached.
Throws:
java.lang.Exception - if an IO error occurs.

read

int read(byte[] b,
         int off,
         int len)
         throws java.lang.Exception
Reads up to the specified number of bytes from the stream into the specified byte array starting at the starting position for the offset.
Parameters:
b - the buffer into which the data will be read.
off - the starting position for the offset in the byte array.
len - the maximum number of bytes to be read.
Returns:
the number of bytes read into the buffer, or -1 if the end of the BLOB was reached before any data was read.
Throws:
java.lang.Exception - if an IO error occurs.

read

int read(byte[] b)
         throws java.lang.Exception
Reads up to the specified number of bytes from the stream into the specified byte array of specified length. If there are fewer than the specified number of bytes in the stream, the actual number of bytes in the stream is read.
Parameters:
b - the buffer into which the data will be read.
Returns:
the number of bytes read into the buffer, or -1 if the end of the stream was reached before any data was read.
Throws:
java.lang.Exception - if an IO error occurs.

skip

long skip(long n)
          throws java.lang.Exception
Attempts to skip over the specified number of bytes of input.

This method may skip over some smaller number of bytes, possibly zero. This action may result from a number of conditions. For example, reaching the end of the stream before the specified number of bytes have been skipped. This method never throws an end-of-file exception.

Parameters:
n - the number of bytes to be skipped.
Returns:
the actual number of bytes skipped.
Throws:
java.lang.Exception - if an IO error occurs.

close

void close()
           throws java.lang.Exception
Closes the input stream and releases any resources associated with this stream.
Throws:
java.lang.Exception - 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.