org.logi.crypto
Class Producer
java.lang.Object
|
+--org.logi.crypto.Crypto
|
+--org.logi.crypto.Producer
- All Implemented Interfaces:
- PrettyPrintable, java.lang.Runnable
- Direct Known Subclasses:
- OFBProducer
- public abstract class Producer
- extends Crypto
- implements java.lang.Runnable
Subclasses of Producer can run in their own thread producing bytes which
can be used by a consumer thread. The produced bytes are stored in a
fixed-size buffer, the size of which is specified when the object is
created.
Concrete implementations must implement the method
public abstract void calculate(byte[] buf);
to fill the array buf with the buf.length bytest
of the data to be buffered.
- Author:
- Logi Ragnarsson
(logir@logi.org)
Fields inherited from class org.logi.crypto.Crypto |
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO |
Method Summary |
abstract void |
calculate(byte[] buf)
Fills buf with newly produced bytes. |
void |
kill()
Terminate the producer thread. |
byte[] |
nextBuffer()
Return the next array of bytes calculated by the producer. |
void |
run()
Repeatedly call calculate(byte[]) on each of the sub-buffers,
respecting the locking semantics of nextBuffer(). |
Methods inherited from class org.logi.crypto.Crypto |
binString, binString, ensureArrayLength, ensureArrayLength, equal, equalRelaxed, equalSub, fromHexNibble, fromHexString, fromString, fromString, hexString, hexString, hexString, hexString, hexString, initRandom, initRandom, makeClass, makeInt, makeLong, makeSessionKey, pastSpace, pickBits, pickBits, prettyPrint, prettyPrint, readBlock, readInt, trimArrayLength, trimArrayLength, trimLeadingZeroes, writeBytes, writeBytes, writeInt |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
kill
public void kill()
- Terminate the producer thread.
nextBuffer
public byte[] nextBuffer()
- Return the next array of bytes calculated by the producer. The thread
calling this method will have exclusive access to the returned array
until the next call to this method, after which the producer thread
may fill it with new bytes.
run
public void run()
- Repeatedly call calculate(byte[]) on each of the sub-buffers,
respecting the locking semantics of nextBuffer().
- Specified by:
run
in interface java.lang.Runnable
calculate
public abstract void calculate(byte[] buf)
- Fills buf with newly produced bytes.
Copyright 1997-2000 Logi Ragnarsson