|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.monkeycoder.monkeynetwork.TurboBuffer
public class TurboBuffer
This class is for buffering network data quickly and intelligently. It
uses memory for smaller content and a file storage device for larger. This
buffer system is always in either read or write mode, but never both. A new
TurboBuffer starts in write mode and remains in write mode until an InputStream
is requested. It can be returned to write mode by calling reset().
This class uses monkeynetwork.ini and requires the following
parameters:
turbo_buffer_size - Size in bytes of the RAM buffer.turbo_buffer_temp_dir - Temporary directory for file storage mode.
| Constructor Summary | |
|---|---|
TurboBuffer()
Creates a TurboBuffer for content storage. |
|
| Method Summary | |
|---|---|
void |
dumpToFile(java.io.File inTargetFile)
Dumps the contents of the TurboBuffer to a File. |
java.io.InputStream |
getInputStream()
Request an InputStream providing access to the data stored in the TurboBuffer. |
void |
reset()
Fully resets this TurboBuffer. |
void |
write(byte inData)
Write a single byte into the TurboBuffer. |
void |
write(byte[] inData)
Write an entire array of bytes into the TurboBuffer. |
void |
write(byte[] inData,
int inOffset,
int inLength)
Write part of an array of bytes into the TurboBuffer. |
void |
write(int inData)
Write the least significant byte of a single integer into the TurboBuffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TurboBuffer()
| Method Detail |
|---|
public void reset()
public void write(byte[] inData)
throws java.io.IOException,
MonkeyException
inData - Array containing the data to write.
java.io.IOException - When one is thrown by underlying code.
MonkeyException - If an InputStream to the stored data has already been requested.
public void write(byte[] inData,
int inOffset,
int inLength)
throws java.io.IOException,
MonkeyException
inData - Array containing the data to write.inOffset - The starting location of data to write from the array.inLength - The length of data to write from the array.
java.io.IOException - When one is thrown by underlying code.
MonkeyException - If an InputStream to the stored data has already been requested.
public void write(int inData)
throws java.io.IOException,
MonkeyException
inData - The integer to write.
java.io.IOException - When one is thrown by underlying code.
MonkeyException - If an InputStream to the stored data has already been requested.
public void write(byte inData)
throws java.io.IOException,
MonkeyException
inData - The byte of data to write.
java.io.IOException - When one is thrown by underlying code.
MonkeyException - If an InputStream to the stored data has already been requested.
public java.io.InputStream getInputStream()
throws java.io.IOException
reset().
java.io.IOException - When one is thrown by underlying code.reset()
public void dumpToFile(java.io.File inTargetFile)
throws java.io.IOException
java.io.IOException - When one is thrown by underlying code.getInputStream()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||