Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.ojc.interfaces
Interface Storage

All Known Implementing Classes:
DirectoryStorage, FileStorage, IdeStorage, JarStorage, JarStorage

public interface Storage

The Storage interface supplies an abstract layer for accessing file systems and their contents. A Storage can either be a directory or a data Storage. Write access support is optional.


Method Summary
 void close()
          Closes a Storage that previously opened for data access.
 Storage create(java.lang.String name)
          Creates a new Storage for data access if doesn't exists yet.
 Storage createDir(java.lang.String name)
          Creates a new directory Storage if doesn't exists yet.
 java.lang.String getCanonicalPath()
          Returns the canonical path name of this Storage.
 java.lang.String getName()
          Returns the name of this Storage (without leading directories).
 java.lang.String getPath()
          Returns the path name of this Storage.
 java.lang.Object getProperty(java.lang.String property)
          Queries custom property associated with this Storage.
 boolean isDirectory()
          Indicates whether this is a directory Storage.
 boolean isInJar()
          Indicates whether this Storage is contained in a zip/jar file.
 java.lang.String[] list()
          Lists all names of Storages within this directory Storage.
 java.util.ArrayList listStorage()
          Lists all Storages within this directory Storage.
 long modDate()
          Returns date of last modification of this Storage.
 void open()
          Opens a Storage for access.
 Storage open(java.lang.String name)
          Opens a Storage for access.
 byte[] read()
          Reads the entire contents of this data Storage.
 int read(byte[] buf)
          Tries to fill a buffer with data from contents of this Storage.
 void setProperty(java.lang.String property, java.lang.Object value)
          Allows association of custom properties with this Storage.
 int size()
          Returns the size of contents of this data Storage.
 void write(byte[] buf, int start, int len)
          Write the contents of a byte array into this Storage.
 

Method Detail

getName

java.lang.String getName()
Returns the name of this Storage (without leading directories).

Returns:
name

getPath

java.lang.String getPath()
Returns the path name of this Storage.

Returns:
path

getCanonicalPath

java.lang.String getCanonicalPath()
Returns the canonical path name of this Storage.

Returns:
canonical path

modDate

long modDate()
Returns date of last modification of this Storage.

Returns:
date of modification

isDirectory

boolean isDirectory()
Indicates whether this is a directory Storage.

Returns:
true if directory else false

isInJar

boolean isInJar()
Indicates whether this Storage is contained in a zip/jar file.

Returns:
true if in jar/zip file else false

setProperty

void setProperty(java.lang.String property,
                 java.lang.Object value)
Allows association of custom properties with this Storage.

Parameters:
property - property key
value - property value

getProperty

java.lang.Object getProperty(java.lang.String property)
Queries custom property associated with this Storage.

Parameters:
property - property key
Returns:
property value

size

int size()
         throws java.io.IOException
Returns the size of contents of this data Storage. Note that this must not be a directory Storage.

Returns:
size of Storage data in bytes
Throws:
java.io.IOException

read

byte[] read()
            throws java.io.IOException
Reads the entire contents of this data Storage. Note that this must not be a directory Storage.

Returns:
byte buffer containing all data of the Storage
Throws:
java.io.IOException

read

int read(byte[] buf)
         throws java.io.IOException
Tries to fill a buffer with data from contents of this Storage. Note that this Storage must not be a directory Storage and must have been opened before attempting to read.

Parameters:
buf - buffer to be filled
Returns:
actual number of bytes read
Throws:
java.io.IOException

write

void write(byte[] buf,
           int start,
           int len)
           throws java.io.IOException
Write the contents of a byte array into this Storage. Note that this Storage must not be a directory Storage, support write access and been opened before attempting to write.

Parameters:
buf - buffer to be written
start - offset within buffer where data starts
len - amount of data from buffer to be written
Throws:
java.io.IOException

list

java.lang.String[] list()
Lists all names of Storages within this directory Storage. Note that this must be a directory Storage.


listStorage

java.util.ArrayList listStorage()
Lists all Storages within this directory Storage. Note that this must be a directory Storage.


open

void open()
          throws java.io.IOException
Opens a Storage for access.

Throws:
java.io.IOException

open

Storage open(java.lang.String name)
Opens a Storage for access.

Parameters:
name - of Storage to be accessed
Returns:
Storage to be accessed

create

Storage create(java.lang.String name)
               throws java.io.IOException
Creates a new Storage for data access if doesn't exists yet. Note that this must be a directory Storage and support write access.

Parameters:
name - of Storage to be created
Returns:
Storage created
Throws:
java.io.IOException

createDir

Storage createDir(java.lang.String name)
                  throws java.io.IOException
Creates a new directory Storage if doesn't exists yet. Note that this must be a directory Storage and support write access.

Parameters:
name - of Storage to be created
Returns:
Storage created
Throws:
java.io.IOException

close

void close()
Closes a Storage that previously opened for data access.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.