jpl.pds.server
Class ChunkedFileHandler

java.lang.Object
  extended by jpl.pds.server.ChunkedFileHandler
All Implemented Interfaces:
FileQuerier
Direct Known Subclasses:
DirFileListHandler, DirListHandler, FileListHandler, JPEGFileHandler, RawFileHandler, ZipDFileHandler, ZipFileHandler, ZipNFileHandler, ZipTESFileHandler

public abstract class ChunkedFileHandler
extends Object
implements FileQuerier

Abstract querier that chunks product results.

Author:
Kelly.

Constructor Summary
protected ChunkedFileHandler()
          Creates a new ChunkedFileHandler instance.
 
Method Summary
protected  void addProduct(String id, File file, boolean temporary)
          Add a new product.
 void close(String id)
          Close a chunked file.
protected  File getFile(String id)
          Get the file corresponding to a product ID.
 byte[] retrieveChunk(String id, long offset, int length)
          Retrieve a chunk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jpl.pds.server.FileQuerier
queryForFile
 

Constructor Detail

ChunkedFileHandler

protected ChunkedFileHandler()
Creates a new ChunkedFileHandler instance.

Method Detail

retrieveChunk

public byte[] retrieveChunk(String id,
                            long offset,
                            int length)
                     throws IOException
Description copied from interface: FileQuerier
Retrieve a chunk.

Specified by:
retrieveChunk in interface FileQuerier
Parameters:
id - Product ID.
offset - Where to retrieve a fragment.
length - How big a fragment to get.
Returns:
The fragment.
Throws:
IOException - if an error occurs.

close

public void close(String id)
           throws IOException
Description copied from interface: FileQuerier
Close a chunked file.

Specified by:
close in interface FileQuerier
Parameters:
id - Product ID.
Throws:
IOException - if an error occurs.

getFile

protected File getFile(String id)
Get the file corresponding to a product ID.

Parameters:
id - Product ID.
Returns:
a File value.

addProduct

protected void addProduct(String id,
                          File file,
                          boolean temporary)
Add a new product.

Parameters:
id - Product ID.
file - File that contains the product date.
temporary - True if the file is a temporary file, false otherwise.


Copyright © 2005-2012 Planetary Data System. All Rights Reserved.