Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Sun Message Library for SWIFT API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.stc.swift.runtime
Class SwiftOtdInputStream

    java.lang.Object
      com.stc.swift.runtime.SwiftOtdInputStream

All Implemented Interfaces:
  com.stc.otd.runtime.OtdInputStream

    public class SwiftOtdInputStream

extends java.lang.Object
implements com.stc.otd.runtime.OtdInputStream

Class to implement an OTD input stream based on an existing stream. This class uses an local temporary file to hold a copy of any data that may be rewound.

Version:
  $Revision: 1.3 $

Constructor Summary
`SwiftOtdInputStream(java.io.File file)` Constructs from an file name.
`SwiftOtdInputStream(java.lang.String file)` Constructs from an file name.

Method Summary
`void` | `begin()` Indicates the beginning of reading a message.
`boolean` | `end()` Indicates the end of reading a message.
`boolean` | `eof()` Indicates the end of file.
`com.stc.otd.runtime.OtdInputStreamMark` | `mark()` Mark that represents the current read head position.
`long` | `offset()` Gives the current read head position.
`int` | `read()` Read a single byte.
`int` | `read(byte[] buffer)` Fills given buffer with as much data as possible.
`int` | `read(byte[] buffer, int offset)` Fills given buffer with as much data as possible.
`int` | `read(byte[] buffer, int offset, int length)` Fills given buffer with as much data as possible.
`void` | `rewind()` Returns to the very beginning of the stream, which is implicitly marked.
`void` | `seek(com.stc.otd.runtime.OtdInputStreamMark mark)` Returns to position of given mark.
`void` | `skip(long n)` Skips the given number of bytes ahead.

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

Constructor Detail

### SwiftOtdInputStream

    public SwiftOtdInputStream(java.lang.String file)
                        throws java.io.FileNotFoundException

  Constructs from an file name.

  Parameters:
    `file` - a file name.
  Throws:
    `java.io.FileNotFoundException`

### SwiftOtdInputStream

    public SwiftOtdInputStream(java.io.File file)
                        throws java.io.FileNotFoundException

  Constructs from an file name.

  Parameters:
    `file` - a file name.
  Throws:
    `java.io.FileNotFoundException`

Method Detail

### begin

    public void begin()

  Indicates the beginning of reading a message. Required by the OtdInputStream interface.

  Specified by:
    `begin` in interface `com.stc.otd.runtime.OtdInputStream`

### end

    public boolean end()

  Indicates the end of reading a message. Required by the OtdInputStream interface.

  Specified by:
    `end` in interface `com.stc.otd.runtime.OtdInputStream`
  Returns:
    whether we are at the stream end

### eof

    public boolean eof()

  Indicates the end of file. Required by the OtdInputStream interface.

  Returns:
    whether we are at the stream end

### offset

    public long offset()

  Gives the current read head position. Required by the OtdInputStream interface.

  Returns:
    Current read head position.

### mark

    public com.stc.otd.runtime.OtdInputStreamMark mark()

  Mark that represents the current read head position.

  Specified by:
    `mark` in interface `com.stc.otd.runtime.OtdInputStream`
  Returns:
    cookie that encapsulates the current read position.

### read

    public int read()
             throws java.io.IOException

  Read a single byte.

  Specified by:
    `read` in interface `com.stc.otd.runtime.OtdInputStream`
  Returns:
    the byte value (range0...255)
  Throws:
    `java.io.IOException` - if at end of data.

### read

    public int read(byte[] buffer)
             throws java.io.IOException

  Fills given buffer with as much data as possible. May block until data becomes available. If less data is returned that the buffer can contain, this implies we are at the EOF.

  Specified by:
    `read` in interface `com.stc.otd.runtime.OtdInputStream`
  Parameters:
    `buffer` - the array to receive the data
  Returns:
    the number of bytes added to the buffer
  Throws:
    `java.io.IOException` - for input problem

### read

    public int read(byte[] buffer,
                    int offset)
             throws java.io.IOException

  Fills given buffer with as much data as possible.

  Parameters:
    `buffer` - the array to receive the data
    `offset` - starting index in buffer for new data
  Returns:
    the number of bytes added to the buffer
  Throws:
    `java.io.IOException` - for input problem

### read

    public int read(byte[] buffer,
                    int offset,
                    int length)
             throws java.io.IOException

  Fills given buffer with as much data as possible. May be less than .

  Specified by:
    `read` in interface `com.stc.otd.runtime.OtdInputStream`
  Parameters:
    `buffer` - the array to receive the data
    `offset` - starting index in buffer for new data
    `length` - number of bytes to read
  Returns:
    the number of bytes added to the buffer
  Throws:
    `java.lang.IllegalArgumentException` - if tribble found with <offseth> of <length>
    `java.io.IOException` - for input problem

### rewind

    public void rewind()
                throws java.io.IOException

  Returns to the very beginning of the stream, which is implicitly marked.

  Specified by:
    `rewind` in interface `com.stc.otd.runtime.OtdInputStream`
  Throws:
    `java.io.IOException` - for input problem

### seek

    public void seek(com.stc.otd.runtime.OtdInputStreamMark mark)
              throws java.io.IOException

  Returns to position of given mark.

  Specified by:
    `seek` in interface `com.stc.otd.runtime.OtdInputStream`
  Parameters:
    `mark` - cookie returned by mark()
  Throws:
    `java.io.IOException` - for input problem

### skip

    public void skip(long n)
              throws java.io.IOException

  Skips the given number of bytes ahead. Trying to skip past the end-of-file will throw an I/O exception.

  Specified by:
    `skip` in interface `com.stc.otd.runtime.OtdInputStream`
  Parameters:
    `count` - the number of bytes to skip; non-negative number
  Throws:
    `java.io.IOException` - for input problem

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Sun Message Library for SWIFT API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Sun Microsystems, Inc. All rights reserved.