com.gc.iotools.stream.store
Class OnOffStore

java.lang.Object
  extended by com.gc.iotools.stream.store.OnOffStore
All Implemented Interfaces:
SeekableStore, Store

public class OnOffStore
extends Object
implements SeekableStore

OnOffStore class.

Version:
$Id: OnOffStore.java 463 2011-01-21 23:54:17Z dvd.smnt@gmail.com $
Author:
gcontini

Constructor Summary
OnOffStore(SeekableStore store)
          Constructor for OnOffStore.
 
Method Summary
 void cleanup()
          Cleans up the Store.
 void enable(boolean enable)
          enable
 int get(byte[] bytes, int offset, int length)
          gets length bytes from the store.
 void put(byte[] bytes, int offset, int length)
          put
 void seek(long position)
          Reposition this Store on a previously read position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OnOffStore

public OnOffStore(SeekableStore store)

Constructor for OnOffStore.

Parameters:
store - a SeekableStore object.
Method Detail

cleanup

public void cleanup()
Cleans up the Store. Forget all the data previously stored.

Specified by:
cleanup in interface Store

enable

public void enable(boolean enable)

enable

Parameters:
enable - a boolean.

get

public int get(byte[] bytes,
               int offset,
               int length)
        throws IOException
gets length bytes from the store.

Specified by:
get in interface Store
Parameters:
bytes - array where to put the data in.
offset - offset in the array to start put the data.
length - length of the bytes got from the store.
Returns:
number of bytes effectively put in the array or -1 if the Store was empty.
Throws:
IOException - when an error occurs in the store, and data can't be retrieved.

put

public void put(byte[] bytes,
                int offset,
                int length)
         throws IOException

put

Specified by:
put in interface Store
Parameters:
bytes - an array of byte.
offset - a int.
length - a int.
Throws:
IOException - if any.

seek

public void seek(long position)
          throws IOException
Reposition this Store on a previously read position.

Specified by:
seek in interface SeekableStore
Parameters:
position - position to read the data from.
Throws:
IOException - If some error in the internal store happens.
EOFException - If a position is greater than the actual Store size.


Copyright © 2008-2011. All Rights Reserved.