edu.mit.jwi
Class RAMDictionary

java.lang.Object
  extended by edu.mit.jwi.RAMDictionary
All Implemented Interfaces:
IClosable, IHasCharset, IHasLifecycle, ILoadable, ILoadPolicy, IDictionary, IRAMDictionary, IHasVersion

public class RAMDictionary
extends java.lang.Object
implements IRAMDictionary

Default implementation of the IRAMDictionary interface. This implementation is designed to wrap an arbitrary dictionary object; however, convenience constructors are provided for the most common use cases:

Note: If you receive an OutOfMemoryError while using this object (this can occur on 32 bit JVMs), try increasing your heap size, for example, by using the -Xmx switch.

Since:
JWI 2.2.0
Version:
2.4.0
Author:
Mark A. Finlayson

Nested Class Summary
static class RAMDictionary.DataLoader
          A Callable that creates a dictionary data from a specified dictionary.
static class RAMDictionary.DictionaryData
          Object that holds all the dictionary data loaded from the Wordnet files.
protected  class RAMDictionary.HotSwappableExceptionEntryIterator
          A hot swappable iterator that iterates over exceptions entries for a particular part of speech.
protected  class RAMDictionary.HotSwappableIndexWordIterator
          A hot swappable iterator for index words.
protected  class RAMDictionary.HotSwappableIterator<E>
          An iterator that allows the dictionary to be loaded into memory while it is iterating.
protected  class RAMDictionary.HotSwappableSenseEntryIterator
          A hot swappable iterator that iterates over sense entries.
protected  class RAMDictionary.HotSwappableSynsetIterator
          A hot swappable iterator for synsets.
protected  class RAMDictionary.JWIBackgroundDataLoader
          This runnable loads the dictionary data into memory and sets the appropriate variable in the parent dictionary.
 
Nested classes/interfaces inherited from interface edu.mit.jwi.IRAMDictionary
IRAMDictionary.FileInputStreamFactory, IRAMDictionary.IInputStreamFactory, IRAMDictionary.URLInputStreamFactory
 
Nested classes/interfaces inherited from interface edu.mit.jwi.data.IHasLifecycle
IHasLifecycle.LifecycleState, IHasLifecycle.ObjectClosedException, IHasLifecycle.ObjectOpenException
 
Field Summary
protected  IDictionary backing
           
protected  RAMDictionary.DictionaryData data
           
static int defaultLoadPolicy
          The default load policy of a RAMDictionary is to load data in the background when opened.
protected  IRAMDictionary.IInputStreamFactory factory
           
protected  java.util.concurrent.locks.Lock lifecycleLock
           
protected  java.lang.Thread loader
           
protected  java.util.concurrent.locks.Lock loadLock
           
protected  int loadPolicy
           
protected  IHasLifecycle.LifecycleState state
           
 
Fields inherited from interface edu.mit.jwi.data.ILoadPolicy
BACKGROUND_LOAD, IMMEDIATE_LOAD, NO_LOAD
 
Constructor Summary
  RAMDictionary(java.io.File file)
          Constructs a new wrapper RAM dictionary that will load the contents the specified local Wordnet data, with the specified load policy.
  RAMDictionary(java.io.File file, int loadPolicy)
          Loads data from the specified File using the specified load policy.
  RAMDictionary(IDictionary dict, int loadPolicy)
          Constructs a new RAMDictionary that will load the contents of the wrapped dictionary into memory, with the specified load policy.
protected RAMDictionary(IDictionary backing, IRAMDictionary.IInputStreamFactory factory, int loadPolicy)
          This is a internal constructor that unifies the constructor decision matrix.
  RAMDictionary(IRAMDictionary.IInputStreamFactory factory)
          Constructs a new RAMDictionary that will load an in-memory image from the specified stream factory.
  RAMDictionary(java.net.URL url)
          Constructs a new RAMDictionary that will load the contents the specified Wordnet data using the default load policy.
  RAMDictionary(java.net.URL url, int loadPolicy)
          Loads data from the specified URL using the specified load policy.
 
Method Summary
protected  IHasLifecycle.LifecycleState assertLifecycleState()
          This is an internal utility method that determines whether this dictionary should be considered open or closed.
 void close()
          This closes the object by disposing of data backing objects or connections.
static IDictionary createBackingDictionary(java.io.File file)
          Creates a DataSourceDictionary out of the specified file, as long as the file points to an existing local directory.
static IDictionary createBackingDictionary(java.net.URL url)
          Creates a DataSourceDictionary out of the specified url, as long as the url points to an existing local directory.
static IRAMDictionary.IInputStreamFactory createInputStreamFactory(java.io.File file)
          Creates an input stream factory out of the specified File.
static IRAMDictionary.IInputStreamFactory createInputStreamFactory(java.net.URL url)
          Creates an input stream factory out of the specified URL.
static boolean export(java.io.File in, java.io.OutputStream out)
          This is a convenience method that transforms a Wordnet dictionary at the specified file location into a in-memory image written to the specified output stream.
static boolean export(IRAMDictionary.IInputStreamFactory in, java.io.OutputStream out)
          This is a convenience method that transforms a Wordnet dictionary drawn from the specified input stream factory into a in-memory image written to the specified output stream.
protected static boolean export(IRAMDictionary dict, java.io.OutputStream out)
          Exports a specified RAM Dictionary object to the specified output stream.
 void export(java.io.OutputStream out)
          Exports the in-memory contents of the to the specified output stream.
static boolean export(java.net.URL in, java.io.OutputStream out)
          This is a convenience method that transforms a Wordnet dictionary at the specified url location into a in-memory image written to the specified output stream.
 IDictionary getBackingDictionary()
          Returns the dictionary that backs this instance.
 java.nio.charset.Charset getCharset()
          Returns the character set associated with this object.
 IExceptionEntry getExceptionEntry(IExceptionEntryID id)
          Retrieves the exception entry for the specified id from the database.
 IExceptionEntry getExceptionEntry(java.lang.String surfaceForm, POS pos)
          Retrieves the exception entry for the specified surface form and part of speech from the database.
 java.util.Iterator<IExceptionEntry> getExceptionEntryIterator(POS pos)
          Returns an iterator that will iterate over all exception entries of the specified part of speech.
 IIndexWord getIndexWord(IIndexWordID id)
          Retrieves the specified index word object from the database.
 IIndexWord getIndexWord(java.lang.String lemma, POS pos)
          This method is identical to getIndexWord(IIndexWordID) and is provided as a convenience.
 java.util.Iterator<IIndexWord> getIndexWordIterator(POS pos)
          Returns an iterator that will iterate over all index words of the specified part of speech.
 int getLoadPolicy()
          Returns the load policy for this object, expressed as an integer.
 ISenseEntry getSenseEntry(ISenseKey key)
          Retrieves the sense entry for the specified sense key from the database.
 java.util.Iterator<ISenseEntry> getSenseEntryIterator()
          Returns an iterator that will iterate over all sense entries in the dictionary.
 IRAMDictionary.IInputStreamFactory getStreamFactory()
          Returns the stream factory that backs this instance; may be null.
 ISynset getSynset(ISynsetID id)
          Retrieves the synset with the specified id from the database.
 java.util.Iterator<ISynset> getSynsetIterator(POS pos)
          Returns an iterator that will iterate over all synsets of the specified part of speech.
 IVersion getVersion()
          Returns the associated version for this object.
 IWord getWord(ISenseKey key)
          Retrieves the word with the specified sense key from the database.
 IWord getWord(IWordID id)
          Retrieves the word with the specified id from the database.
 boolean isLoaded()
          Returns whether this object is loaded or not.
 boolean isOpen()
          Returns true if the dictionary is open, that is, ready to accept queries; returns false otherwise
 void load()
          Starts a simple, non-blocking load.
 void load(boolean block)
          Initiates the loading process.
 boolean open()
          This opens the object by performing any required initialization steps.
 void setCharset(java.nio.charset.Charset charset)
          Sets the character set associated with this dictionary.
 void setLoadPolicy(int policy)
          Sets the load policy for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultLoadPolicy

public static int defaultLoadPolicy
The default load policy of a RAMDictionary is to load data in the background when opened.

Since:
JWI 2.4.0

backing

protected final IDictionary backing

factory

protected final IRAMDictionary.IInputStreamFactory factory

lifecycleLock

protected final java.util.concurrent.locks.Lock lifecycleLock

loadLock

protected final java.util.concurrent.locks.Lock loadLock

state

protected volatile IHasLifecycle.LifecycleState state

loader

protected transient java.lang.Thread loader

loadPolicy

protected int loadPolicy

data

protected RAMDictionary.DictionaryData data
Constructor Detail

RAMDictionary

public RAMDictionary(java.io.File file)
Constructs a new wrapper RAM dictionary that will load the contents the specified local Wordnet data, with the specified load policy. Note that if the file points to a exported image of an in-memory dictionary, the required load policy is to load immediately.

Parameters:
file - a file pointing to a local copy of wordnet; may not be null
Throws:
java.lang.NullPointerException - if the specified file is null
Since:
JWI 2.4.0

RAMDictionary

public RAMDictionary(java.net.URL url)
Constructs a new RAMDictionary that will load the contents the specified Wordnet data using the default load policy. Note that if the url points to a resource that is the exported image of an in-memory dictionary, the required load policy is to load immediately.

Parameters:
url - a url pointing to a local copy of wordnet; may not be null
Throws:
java.lang.NullPointerException - if the specified url is null
Since:
JWI 2.4.0

RAMDictionary

public RAMDictionary(java.io.File file,
                     int loadPolicy)
Loads data from the specified File using the specified load policy. Note that if the file points to to a resource that is the exported image of an in-memory dictionary, the specified load policy is ignored: the dictionary is loaded into memory immediately.

Parameters:
file - a file pointing to a local copy of wordnet; may not be null
loadPolicy - the load policy of the dictionary; see constants in ILoadPolicy. Note that if the file points to to a resource that is the exported image of an in-memory dictionary, the specified load policy is ignored: the dictionary is loaded into memory immediately.
Throws:
java.lang.NullPointerException - if the specified file is null
Since:
JWI 2.2.0
See Also:
ILoadPolicy

RAMDictionary

public RAMDictionary(java.net.URL url,
                     int loadPolicy)
Loads data from the specified URL using the specified load policy. Note that if the url points to a resource that is the exported image of an in-memory dictionary, the specified load policy is ignored: the dictionary is loaded into memory immediately.

Parameters:
url - a url pointing to a local copy of wordnet; may not be null
loadPolicy - the load policy of the dictionary; see constants in ILoadPolicy. Note that if the url points to to a resource that is the exported image of an in-memory dictionary, the specified load policy is ignored: the dictionary is loaded into memory immediately.
Throws:
java.lang.NullPointerException - if the specified url is null
Since:
JWI 2.2.0
See Also:
ILoadPolicy

RAMDictionary

public RAMDictionary(IDictionary dict,
                     int loadPolicy)
Constructs a new RAMDictionary that will load the contents of the wrapped dictionary into memory, with the specified load policy.

Parameters:
dict - the dictionary to be wrapped, may not be null
loadPolicy - the load policy of the dictionary; see constants in ILoadPolicy.
Since:
JWI 2.2.0
See Also:
ILoadPolicy

RAMDictionary

public RAMDictionary(IRAMDictionary.IInputStreamFactory factory)
Constructs a new RAMDictionary that will load an in-memory image from the specified stream factory.

Parameters:
factory - the stream factory that provides the stream; may not be null
Throws:
java.lang.NullPointerException - if the factory is null
Since:
JWI 2.4.0

RAMDictionary

protected RAMDictionary(IDictionary backing,
                        IRAMDictionary.IInputStreamFactory factory,
                        int loadPolicy)
This is a internal constructor that unifies the constructor decision matrix. Exactly one of the backing dictionary or the input factory must be non-null, otherwise an exception is thrown. If the factory is non-null, the dictionary will ignore the specified load policy and set the load policy to "immediate load".

Parameters:
backing - the backing dictionary; may be null
factory - the input stream factory; may be null
loadPolicy - the load policy
Since:
JWI 2.4.0
Method Detail

getBackingDictionary

public IDictionary getBackingDictionary()
Returns the dictionary that backs this instance.

Returns:
the dictionary that backs this instance; may be null.
Since:
JWI 2.2.0

getStreamFactory

public IRAMDictionary.IInputStreamFactory getStreamFactory()
Returns the stream factory that backs this instance; may be null.

Returns:
the stream factory that backs this instance; may be null
Since:
JWI 2.4.0

setCharset

public void setCharset(java.nio.charset.Charset charset)
Description copied from interface: IDictionary
Sets the character set associated with this dictionary. The character set may be null.

Specified by:
setCharset in interface IDictionary
Parameters:
charset - the possibly null character set to use when decoding files.

getCharset

public java.nio.charset.Charset getCharset()
Description copied from interface: IHasCharset
Returns the character set associated with this object. May be null.

Specified by:
getCharset in interface IHasCharset
Returns:
the Charset associated this object, possibly null

getLoadPolicy

public int getLoadPolicy()
Description copied from interface: ILoadPolicy
Returns the load policy for this object, expressed as an integer.

Specified by:
getLoadPolicy in interface ILoadPolicy
Returns:
the load policy for this object

setLoadPolicy

public void setLoadPolicy(int policy)
Description copied from interface: ILoadPolicy
Sets the load policy for this object. If the object is currently loaded, or in the process of loading, the load policy will not take effect until the next time objet is instantiated, initialized, or opened.

Specified by:
setLoadPolicy in interface ILoadPolicy
Parameters:
policy - the policy to implement; may be one of NO_LOAD, BACKGROUND_LOAD, IMMEDIATE_LOAD or an implementation-dependent value.

isLoaded

public boolean isLoaded()
Description copied from interface: ILoadable
Returns whether this object is loaded or not. This method should return true only if the loading process has completed and the object is actually loaded; if the object is still in the process of loading, or failed to load, the method should return false.

Specified by:
isLoaded in interface ILoadable
Returns:
true if the method has completed loading; false otherwise

load

public void load()
Description copied from interface: ILoadable
Starts a simple, non-blocking load. If the object is already loaded, the method returns immediately and has no effect. If the object is in the process of loading, the method also returns immediately.

Specified by:
load in interface ILoadable

load

public void load(boolean block)
          throws java.lang.InterruptedException
Description copied from interface: ILoadable
Initiates the loading process. Depending on the flag, the method may return immediately (block is false), or return only when the loading process is complete. If the object is already loaded, the method returns immediately and has no effect. If the object is in the process of loading, and the method is called in blocking mode, the method blocks until loading is complete, even if that call of the method did not initiate the loading process. Some implementors of this interface may not support the immediate-return functionality.

Specified by:
load in interface ILoadable
Parameters:
block - if true, the method returns only when the loading process is complete; if false, the method returns immediately.
Throws:
java.lang.InterruptedException - if the method is blocking, and is interrupted while waiting for loading to complete

open

public boolean open()
             throws java.io.IOException
Description copied from interface: IHasLifecycle
This opens the object by performing any required initialization steps. If this method returns false, then subsequent calls to IHasLifecycle.isOpen() will return false.

Specified by:
open in interface IHasLifecycle
Returns:
true if there were no errors in initialization; false otherwise.
Throws:
java.io.IOException - if there was IO error while performing initializataion

isOpen

public boolean isOpen()
Description copied from interface: IHasLifecycle
Returns true if the dictionary is open, that is, ready to accept queries; returns false otherwise

Specified by:
isOpen in interface IHasLifecycle
Returns:
true if the object is open; false otherwise

close

public void close()
Description copied from interface: IClosable
This closes the object by disposing of data backing objects or connections. If the object is already closed, or in the process of closing, this method does nothing (although, if the object is in the process of closing, it may block until closing is complete).

Specified by:
close in interface IClosable

assertLifecycleState

protected final IHasLifecycle.LifecycleState assertLifecycleState()
This is an internal utility method that determines whether this dictionary should be considered open or closed.

Returns:
the lifecycle state object representing open if the object is open; otherwise the lifecycle state object representing closed
Since:
JWI 2.4.0

export

public void export(java.io.OutputStream out)
            throws java.io.IOException
Description copied from interface: IRAMDictionary
Exports the in-memory contents of the to the specified output stream. This method flushes and closes the output stream when it is done writing the data.

Specified by:
export in interface IRAMDictionary
Parameters:
out - the output stream to which the in-memory data will be written; may not be null
Throws:
java.io.IOException - if there is a problem writing the in-memory data to the output stream.

getVersion

public IVersion getVersion()
Description copied from interface: IHasVersion
Returns the associated version for this object. If this object is not associated with any particular version, this method may return null.

Specified by:
getVersion in interface IHasVersion
Returns:
The associated version, or null if none.

getIndexWord

public IIndexWord getIndexWord(java.lang.String lemma,
                               POS pos)
Description copied from interface: IDictionary
This method is identical to getIndexWord(IIndexWordID) and is provided as a convenience.

Specified by:
getIndexWord in interface IDictionary
Parameters:
lemma - the lemma for the index word requested; may not be null, empty, or all whitespace
pos - the part of speech; may not be null
Returns:
the index word corresponding to the specified lemma and part of speech, or null if none is found

getIndexWord

public IIndexWord getIndexWord(IIndexWordID id)
Description copied from interface: IDictionary
Retrieves the specified index word object from the database. If the specified lemma/part of speech combination is not found, returns null.

Note: This call does no stemming on the specified lemma, it is taken as specified. That is, if you submit the word "dogs", it will search for "dogs", not "dog"; in the standard Wordnet distribution, there is no entry for "dogs" and therefore the call will return null. This is in contrast to the Wordnet API provided by Princeton. If you want your searches to capture morphological variation, use the descendants of the IStemmer class.

Specified by:
getIndexWord in interface IDictionary
Parameters:
id - the id of the index word to search for; may not be null
Returns:
the index word, if found; null otherwise

getIndexWordIterator

public java.util.Iterator<IIndexWord> getIndexWordIterator(POS pos)
Description copied from interface: IDictionary
Returns an iterator that will iterate over all index words of the specified part of speech.

Specified by:
getIndexWordIterator in interface IDictionary
Parameters:
pos - the part of speech over which to iterate; may not be null
Returns:
an iterator that will iterate over all index words of the specified part of speech

getWord

public IWord getWord(IWordID id)
Description copied from interface: IDictionary
Retrieves the word with the specified id from the database. If the specified word is not found, returns null

Specified by:
getWord in interface IDictionary
Parameters:
id - the id of the word to search for; may not be null
Returns:
the word, if found; null otherwise

getWord

public IWord getWord(ISenseKey key)
Description copied from interface: IDictionary
Retrieves the word with the specified sense key from the database. If the specified word is not found, returns null

Specified by:
getWord in interface IDictionary
Parameters:
key - the sense key of the word to search for; may not be null
Returns:
the word, if found; null otherwise

getSynset

public ISynset getSynset(ISynsetID id)
Description copied from interface: IDictionary
Retrieves the synset with the specified id from the database. If the specified synset is not found, returns null

Specified by:
getSynset in interface IDictionary
Parameters:
id - the id of the synset to search for; may not be null
Returns:
the synset, if found; null otherwise

getSynsetIterator

public java.util.Iterator<ISynset> getSynsetIterator(POS pos)
Description copied from interface: IDictionary
Returns an iterator that will iterate over all synsets of the specified part of speech.

Specified by:
getSynsetIterator in interface IDictionary
Parameters:
pos - the part of speech over which to iterate; may not be null
Returns:
an iterator that will iterate over all synsets of the specified part of speech

getSenseEntry

public ISenseEntry getSenseEntry(ISenseKey key)
Description copied from interface: IDictionary
Retrieves the sense entry for the specified sense key from the database. If the specified sense key has no associated sense entry, returns null

Specified by:
getSenseEntry in interface IDictionary
Parameters:
key - the sense key of the entry to search for; may not be null
Returns:
the entry, if found; null otherwise

getSenseEntryIterator

public java.util.Iterator<ISenseEntry> getSenseEntryIterator()
Description copied from interface: IDictionary
Returns an iterator that will iterate over all sense entries in the dictionary.

Specified by:
getSenseEntryIterator in interface IDictionary
Returns:
an iterator that will iterate over all sense entries

getExceptionEntry

public IExceptionEntry getExceptionEntry(java.lang.String surfaceForm,
                                         POS pos)
Description copied from interface: IDictionary
Retrieves the exception entry for the specified surface form and part of speech from the database. If the specified surface form/ part of speech pair has no associated exception entry, returns null

Specified by:
getExceptionEntry in interface IDictionary
Parameters:
surfaceForm - the surface form to be looked up; may not be null , empty, or all whitespace
pos - the part of speech; may not be null
Returns:
the entry, if found; null otherwise

getExceptionEntry

public IExceptionEntry getExceptionEntry(IExceptionEntryID id)
Description copied from interface: IDictionary
Retrieves the exception entry for the specified id from the database. If the specified id is not found, returns null

Specified by:
getExceptionEntry in interface IDictionary
Parameters:
id - the exception entry id of the entry to search for; may not be null
Returns:
the exception entry for the specified id

getExceptionEntryIterator

public java.util.Iterator<IExceptionEntry> getExceptionEntryIterator(POS pos)
Description copied from interface: IDictionary
Returns an iterator that will iterate over all exception entries of the specified part of speech.

Specified by:
getExceptionEntryIterator in interface IDictionary
Parameters:
pos - the part of speech over which to iterate; may not be null
Returns:
an iterator that will iterate over all exception entries of the specified part of speech

createInputStreamFactory

public static IRAMDictionary.IInputStreamFactory createInputStreamFactory(java.io.File file)
Creates an input stream factory out of the specified File. If the file points to a local directory then the method returns null.

Parameters:
file - the file out of which to make an input stream factory; may not be null
Returns:
a new input stream factory, or null if the url points to a local directory.
Throws:
java.lang.NullPointerException - if the specified file is null
Since:
JWI 2.4.0

createInputStreamFactory

public static IRAMDictionary.IInputStreamFactory createInputStreamFactory(java.net.URL url)
Creates an input stream factory out of the specified URL. If the url points to a local directory then the method returns null.

Parameters:
url - the url out of which to make an input stream factory; may not be null
Returns:
a new input stream factory, or null if the url points to a local directory.
Throws:
java.lang.NullPointerException - if the specified url is null
Since:
JWI 2.4.0

createBackingDictionary

public static IDictionary createBackingDictionary(java.io.File file)
Creates a DataSourceDictionary out of the specified file, as long as the file points to an existing local directory.

Parameters:
file - the local directory for which to create a data source dictionary; may not be null
Returns:
a dictionary object that uses the specified local directory as its data source; otherwise, null
Throws:
java.lang.NullPointerException - if the specified file is null
Since:
JWI 2.4.0

createBackingDictionary

public static IDictionary createBackingDictionary(java.net.URL url)
Creates a DataSourceDictionary out of the specified url, as long as the url points to an existing local directory.

Parameters:
url - the local directory for which to create a data source dictionary; may not be null
Returns:
a dictionary object that uses the specified local directory as its data source; otherwise, null
Throws:
java.lang.NullPointerException - if the specified url is null
Since:
JWI 2.4.0

export

public static boolean export(java.io.File in,
                             java.io.OutputStream out)
                      throws java.io.IOException
This is a convenience method that transforms a Wordnet dictionary at the specified file location into a in-memory image written to the specified output stream. The file may point to either a directory or in-memory image.

Parameters:
in - the file from which the Wordnet data should be loaded; may not be null
out - the output stream to which the Wordnet data should be written; may not be null
Returns:
true if the export was successful
Throws:
java.lang.NullPointerException - if either argument is null
java.io.IOException - if there is an IO problem when opening or exporting the dictionary.
Since:
JWI 2.4.0

export

public static boolean export(java.net.URL in,
                             java.io.OutputStream out)
                      throws java.io.IOException
This is a convenience method that transforms a Wordnet dictionary at the specified url location into a in-memory image written to the specified output stream. The url may point to either a directory or in-memory image.

Parameters:
in - the url from which the Wordnet data should be loaded; may not be null
out - the output stream to which the Wordnet data should be written; may not be null
Returns:
true if the export was successful
Throws:
java.lang.NullPointerException - if either argument is null
java.io.IOException - if there is an IO problem when opening or exporting the dictionary.
Since:
JWI 2.4.0

export

public static boolean export(IRAMDictionary.IInputStreamFactory in,
                             java.io.OutputStream out)
                      throws java.io.IOException
This is a convenience method that transforms a Wordnet dictionary drawn from the specified input stream factory into a in-memory image written to the specified output stream.

Parameters:
in - the file from which the Wordnet data should be loaded; may not be null
out - the output stream to which the Wordnet data should be written; may not be null
Returns:
true if the export was successful
Throws:
java.lang.NullPointerException - if either argument is null
java.io.IOException - if there is an IO problem when opening or exporting the dictionary.
Since:
JWI 2.4.0

export

protected static boolean export(IRAMDictionary dict,
                                java.io.OutputStream out)
                         throws java.io.IOException
Exports a specified RAM Dictionary object to the specified output stream. This is convenience method.

Parameters:
dict - the dictionary to be exported; the dictionary will be closed at the end of the method.
out - the output stream to which the data will be written.
Returns:
true if the export was successful
Throws:
java.io.IOException - if there was a IO problem during export
Since:
JWI 2.4.0


Copyright © 2007-2013 Massachusetts Institute of Technology. All Rights Reserved.