Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ifs.server
Class S_RandomAccessorImpl

    java.lang.Object
      oracle.ifs.server.S_RandomAccessorImpl

All Implemented Interfaces:
  RandomAccessor

    public class S_RandomAccessorImpl

extends java.lang.Object
implements RandomAccessor

RandomAccessorImpl is the serverside implementation of RandomAccessor.

(Unpublished)

Constructor Summary
`protected` | `S_RandomAccessorImpl(S_Document doc, S_ContentObject co)` Constructs a non-writeable (read-only) S_RandomAccessorImpl.
`protected` | `S_RandomAccessorImpl(S_Document doc, S_ContentObject co, S_LibraryObjectDefinition docdef, long expirationPeriod)` Constructs a writeable S_RandomAccessorImpl.

Method Summary
`void` | `close()` Closes this RandomAccessor, saving any changes to the document.
`void` | `dispose()` Disposes this RandomAccessor, discarding any changes to the document.
`java.lang.Long` | `getContentObjectId()` Gets the id of the ContentObject being accessed by this RandomAccessor.
`java.lang.Long` | `getDocumentId()` Gets the id of the Document being accessed by this RandomAccessor.
`LibrarySessionInterface` | `getSession()` Gets the session associated with this RandomAccessor.
`boolean` | `isWriteable()` Gets whether this RandomAccessor is writeable.
`long` | `length()` Gets the content length.
`int` | `read(long pos, byte[] b, int off, int len)` Reads bytes from content into a byte array.
`protected void` | `setContext(S_LibrarySession session, Transaction transaction)` Called by DMRandomAccessor* methods to record the session and transaction context.
`void` | `setSession(LibrarySessionInterface session)` Sets the session associated with this RandomAccessor.
`java.lang.String` | `toString()`
`void` | `truncate(long len)` Truncates the content to exactly `len` bytes in length.
`void` | `write(long pos, byte[] b, int off, int len)` Writes bytes from a byte array.

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

Constructor Detail

### S_RandomAccessorImpl

    protected S_RandomAccessorImpl(S_Document doc,
                                   S_ContentObject co)
                            throws IfsException

  Constructs a non-writeable (read-only) S_RandomAccessorImpl.

  Parameters:
    `doc` - the document
    `co` - the existing ContentObject
  Throws:
    `IfsException`
  (Unpublished)

### S_RandomAccessorImpl

    protected S_RandomAccessorImpl(S_Document doc,
                                   S_ContentObject co,
                                   S_LibraryObjectDefinition docdef,
                                   long expirationPeriod)
                            throws IfsException

  Constructs a writeable S_RandomAccessorImpl.

  Parameters:
    `doc` - the document
    `co` - the existing ContentObject
    `docdef` - the definition used to update the document
    `expirationPeriod` - the expiration period of this S_RandomAccessorImpl in milliseconds
  Throws:
    `IfsException` - if the operation fails
  (Unpublished)

Method Detail

### getDocumentId

    public java.lang.Long getDocumentId()
                                 throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Gets the id of the Document being accessed by this RandomAccessor.

  Specified by:
    `getDocumentId` in interface `RandomAccessor`
  Returns:
    the Document id
  Throws:
    `IfsException` - if the operation fails

### getContentObjectId

    public java.lang.Long getContentObjectId()
                                      throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Gets the id of the ContentObject being accessed by this RandomAccessor.

  Specified by:
    `getContentObjectId` in interface `RandomAccessor`
  Returns:
    the ContentObject id
  Throws:
    `IfsException` - if the operation fails

### setSession

    public void setSession(LibrarySessionInterface session)
                    throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Sets the session associated with this RandomAccessor.

  A RandomAccessor is initially bound to the session in which it was created. Call this method to safely use the RandomAccessor in the context of a different session.

  Specified by:
    `setSession` in interface `RandomAccessor`
  Parameters:
    `session` - the session
  Throws:
    `IfsException` - if the operation fails

### getSession

    public LibrarySessionInterface getSession()
                                       throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Gets the session associated with this RandomAccessor.

  Specified by:
    `getSession` in interface `RandomAccessor`
  Returns:
    the session
  Throws:
    `IfsException` - if the operation fails

### read

    public int read(long pos,
                    byte[] b,
                    int off,
                    int len)
             throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Reads bytes from content into a byte array.

  Reads from position `pos` in content, where 0 is the first byte in content, 1 is the second byte, and so forth.

  Attempts to read as many as `len` bytes, but a smaller number of bytes may actually be read. Returns 0 if `len` is 0. Otherwise, blocks until at least one byte is read, the end of file is detected, or an error occurs. Returns the number of bytes actually read.

  The bytes are read into `b` starting at index `off`. If `r` is the number of bytes actually read (as returned by the method), the bytes are read into elements `b[off]` through `b[off+r-1]`. Elements `b[off+r]` through `b[off+len-1]` are not changed. Additionally, elements `b[0]` through `b[off-1]` are never changed. Similarly, `b[off+len]` through `b[b.length-1]` are never changed.

  An exception is thrown upon any of the following conditions:

  - `pos < 0`
  - `pos >= length()`
  - `b == null`
  - `off < 0`
  - `len < 0`
  - `off + len > b.length`

  Specified by:
    `read` in interface `RandomAccessor`
  Parameters:
    `pos` - the position in content from which to read
    `b` - the buffer into which to read
    `off` - the offset in the buffer
    `len` - the maximum number of bytes to read
  Returns:
    the actual number of bytes read
  Throws:
    `IfsException` - if the operation fails

### isWriteable

    public boolean isWriteable()
                        throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Gets whether this RandomAccessor is writeable.

  Specified by:
    `isWriteable` in interface `RandomAccessor`
  Returns:
    whether writeable
  Throws:
    `IfsException` - if the operation fails

### write

    public void write(long pos,
                      byte[] b,
                      int off,
                      int len)
               throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Writes bytes from a byte array.

  If `len` is 0, the content is unchanged. Otherwise, the content is changed as specified in the following two paragraphs.

  The bytes `b[off]` through `b[off+len-1]` are written to positions `pos` through `pos + len - 1` in the content, where 0 is the position of the first byte in content, 1 is the second byte, and so forth.

  If, prior to the call, `pos + len > length()`, the method will extend the content so that `pos + len == length()`.

  An exception is thrown upon any of the following conditions:

  - `pos < 0`
  - `b == null`
  - `off < 0`
  - `len < 0`
  - `off + len > b.length`
  - this RandomAccessor is not writeable

  Specified by:
    `write` in interface `RandomAccessor`
  Parameters:
    `pos` - the position in content from which to write
    `b` - the buffer from which to write
    `off` - the offset in the buffer
    `len` - the number of bytes to write
  Throws:
    `IfsException` - if the operation fails

### truncate

    public void truncate(long len)
                  throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Truncates the content to exactly `len` bytes in length.

  If `len > length()`, the content at byte positions `len` through `length() - 1` are dropped, where 0 is the position of the first byte in content, 1 the second byte, and so forth.

  If `len < length()`, the content is resized by zero-filling positions `length()` through `len - 1`.

  If `len == length()`, the method has no effect.

  In all three cases, after the method returns, `length()` will return `len`.

  An exception is thrown if `len < 0` or this RandomAccessor is not writeable.

  Specified by:
    `truncate` in interface `RandomAccessor`
  Parameters:
    `len` - the desired content length
  Throws:
    `IfsException` - if the operation fails

### length

    public long length()
                throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Gets the content length.

  Specified by:
    `length` in interface `RandomAccessor`
  Returns:
    the length, in bytes
  Throws:
    `IfsException` - if the operation fails

### dispose

    public void dispose()
                 throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Disposes this RandomAccessor, discarding any changes to the document.

  To release resources held by the RandomAccessor, an application should call either `close` (to save changes) or `dispose` (to discard changes).

  Specified by:
    `dispose` in interface `RandomAccessor`
  Throws:
    `IfsException` - if the operation fails

### close

    public void close()
               throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Closes this RandomAccessor, saving any changes to the document.

  For a writeable RandomAccessor, a new ContentObject is created for the updated content, and the document's CONTENTOBJECT attribute is set to reference this new ContentObject. Any other changes specified by the DocumentDefinition supplied in creating this RandomAccessor are also applied.

  For a non-writeable RandomAccessor, `close` is equivalent to `dispose`.

  To release resources held by the RandomAccessor, an application should call either `close` (to save changes) or `dispose` (to discard changes).

  Specified by:
    `close` in interface `RandomAccessor`
  Throws:
    `IfsException` - if the operation fails

### toString

    public java.lang.String toString()

  Description copied from class: `S_RandomAccessorImpl`

  Overrides:
    `toString` in class `java.lang.Object`

### setContext

    protected void setContext(S_LibrarySession session,
                              Transaction transaction)
                       throws IfsException

  Description copied from class: `S_RandomAccessorImpl`
  Called by DMRandomAccessor* methods to record the session and transaction context.

  Parameters:
    `session` - the session
    `transaction` - the transaction in progress prior to the DMRandomAccessor* call, or null if none
  Throws:
    `IfsException` - if the operation fails
  (Unpublished)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD