public class BinaryContext extends ViewerContext
This class is not guaranteed to be threadsafe.
| Constructor and Description |
|---|
BinaryContext(ViewerId vi)
Creates and initializes a BinaryContext instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendBytes(byte[] b)
Overloaded.
|
void |
appendBytes(byte[] b,
int off,
int len)
Overloaded.
|
void |
close()
Overridden.
|
byte[] |
getViewerData()
Overridden.
|
void |
loadFromFile(String fileName)
Loads the binary data from a file.
|
void |
loadFromStream(InputStream is)
Loads the binary data from a stream.
|
protected void |
resetData()
Resets the internal data stream.
|
getViewerIdpublic BinaryContext(ViewerId vi)
vi - The viewer ID to usepublic byte[] getViewerData()
getViewerData in class ViewerContextprotected void resetData()
This method is intended to reset the internal data stream if custom handling of data is needed by derived classes.
public void loadFromFile(String fileName) throws IOException
fileName - The name of the file to load the binary data from.NullPointerException - The fileName argument is nullIOException - An I/O error occurredpublic void loadFromStream(InputStream is) throws IOException
is - The stream to load the binary data from.NullPointerException - The is argument is nullIOException - An I/O error occurredpublic void appendBytes(byte[] b)
b - The buffer to appendNullPointerException - The b argument is nullpublic void appendBytes(byte[] b,
int off,
int len)
b - The buffer to appendoff - The offset at which to begin appendinglen - The number of bytes to appendIndexOutOfBoundsException - The sum of the off and len parameters is greater than the
actual buffer length or the off or len arguments are negativeNullPointerException - The b argument is nullpublic void close()
close in class ViewerContextCopyright © 2023. All rights reserved.