org.hd.d.pg2k.svrCore
Class AllExhibitProperties.ExhibitDataSource

java.lang.Object
  extended by org.hd.d.pg2k.svrCore.AllExhibitProperties.ExhibitDataSource
Enclosing class:
AllExhibitProperties

public abstract static class AllExhibitProperties.ExhibitDataSource
extends java.lang.Object

Class that provides data source to get at exhibit data semi-random access or as a sequential stream. An implementor must override getRawFile() and may also override getInputStream() with a markable stream.

This does not hold a lock while calling back to the underlying data source in order to help avoid deadlocks.

The state of an InputStream returned by this is undefined after an IOException from the stream.


Constructor Summary
AllExhibitProperties.ExhibitDataSource()
           
 
Method Summary
 java.io.InputStream getInputStream(ExhibitStaticAttr esa)
          Get a the raw exhibit binary as a (markable) stream to read sequentially.
abstract  void getRawFile(java.nio.ByteBuffer buf, Name.ExhibitFull exhibitName, int position)
          Read a chunk of the raw exhibit binary into the given buffer.
 boolean isExhibitFullyLoaded(ExhibitStaticAttr esa)
          Check if the given exhibit is fully loaded in local/fast store; true if so.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AllExhibitProperties.ExhibitDataSource

public AllExhibitProperties.ExhibitDataSource()
Method Detail

isExhibitFullyLoaded

public boolean isExhibitFullyLoaded(ExhibitStaticAttr esa)
                             throws java.io.IOException
Check if the given exhibit is fully loaded in local/fast store; true if so. This means that the whole exhibit is quickly available, eg in a local file system, for reading.

This is only a hint; an immediately following call to read the exhibit might find the exhibit no longer local.

The result is undefined for a non-existent exhibit.

This may always return false if not sure or not known.

Returns:
true if exhibit is known to be fully/quickly available from local storage, false otherwise
Throws:
java.io.IOException

getRawFile

public abstract void getRawFile(java.nio.ByteBuffer buf,
                                Name.ExhibitFull exhibitName,
                                int position)
                         throws java.io.IOException
Read a chunk of the raw exhibit binary into the given buffer. As for SimpleExhibitPipelineIF.getRawFile().

Throws:
java.io.IOException

getInputStream

public java.io.InputStream getInputStream(ExhibitStaticAttr esa)
Get a the raw exhibit binary as a (markable) stream to read sequentially. The default implementation uses getRawFile() and does no buffering.

The returned stream is thread-safe, but may not behave as expected is used by more than one thread at once, ie concurrent reads are not supported.


DHD Multimedia Gallery V1.60.69

Copyright (c) 1996-2012, Damon Hart-Davis. All rights reserved.