public final class ByteArrayArgument extends TypedArgument
Argument implementation for byte arrays.
This implementation supports byte arrays up to length of the argument type.
| Constructor and Description |
|---|
ByteArrayArgument(int type,
ArgumentType argumentType,
byte[] value)
Initialises an instance of ByteArrayArgument.
|
| Modifier and Type | Method and Description |
|---|---|
void |
copyTo(ParameterBuffer buffer,
Encoding encoding)
Copies this argument into the supplied buffer, uses the supplied
Encoding for string arguments. |
boolean |
equals(java.lang.Object other) |
int |
getLength() |
byte[] |
getValueAsBytes() |
int |
getValueAsInt()
The value of the parameter as int.
|
int |
hashCode() |
ByteArrayArgument |
transformTo(ParameterBufferMetaData parameterBufferMetaData)
If needed, returns a new argument to transform to a suitable argument type, otherwise returns this instance.
|
void |
writeTo(java.io.OutputStream outputStream)
Writes the arguments to the supplied
OutputStream in the XDR format of the type. |
getArgumentTypegetType, getValueAsLong, getValueAsStringpublic ByteArrayArgument(int type,
ArgumentType argumentType,
byte[] value)
type - parameter typeargumentType - argument typevalue - byte arrayjava.lang.IllegalArgumentException - if type is not valid for byte arrays, or if value is nullLengthOverflowException - if the length of value exceeds ArgumentType.getMaxLength()public void writeTo(java.io.OutputStream outputStream)
throws java.io.IOException
ArgumentOutputStream in the XDR format of the type.public int getLength()
getLength in class ArgumentArgument.writeTo(java.io.OutputStream).
This includes the item, the value and other items contributing to the total length (e.g. the length of the value).public int getValueAsInt()
ParameterThe implementation may throw a RuntimeException if the parameter isn't an int (or shouldn't be used as an int).
getValueAsInt in interface ParametergetValueAsInt in class Argumentpublic byte[] getValueAsBytes()
public void copyTo(ParameterBuffer buffer, Encoding encoding)
ParameterEncoding for string arguments.
An instance of Parameter should know how to copy itself into another buffer (eg an instance
of StringArgument would know to call
ParameterBuffer.addArgument(int, String, Encoding)).
The parameter does not need to check if it is the right type of destination buffer (if someone tries to add a TPB argument to a DPB he is free to try that).
buffer - ParameterBuffer instanceencoding - Encoding to use for string properties. A value of null can be used to signal that the
original encoding should be used.public ByteArrayArgument transformTo(ParameterBufferMetaData parameterBufferMetaData)
ArgumenttransformTo in class ArgumentparameterBufferMetaData - parameter buffer metadata (used to determine the needed argument type)public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2001-2026 Jaybird (Firebird JDBC) team. All rights reserved.