java.lang.Object
org.firebirdsql.gds.impl.argument.Argument
org.firebirdsql.gds.impl.argument.TypedArgument
org.firebirdsql.gds.impl.argument.ByteArrayArgument
- All Implemented Interfaces:
Serializable,Parameter
Argument implementation for byte arrays.
This implementation supports byte arrays up to length of the argument type.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionByteArrayArgument(int type, ArgumentType argumentType, byte[] value) Initialises an instance of ByteArrayArgument. -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyTo(ParameterBuffer buffer, Encoding encoding) Copies this argument into the supplied buffer, uses the suppliedEncodingfor string arguments.booleanintbyte[]intThe value of the parameter as int.inthashCode()transformTo(ParameterBufferMetaData parameterBufferMetaData) If needed, returns a new argument to transform to a suitable argument type, otherwise returns this instance.voidwriteTo(OutputStream outputStream) Writes the arguments to the suppliedOutputStreamin the XDR format of the type.Methods inherited from class org.firebirdsql.gds.impl.argument.TypedArgument
getArgumentTypeMethods inherited from class org.firebirdsql.gds.impl.argument.Argument
getType, getValueAsLong, getValueAsString
-
Constructor Details
-
ByteArrayArgument
Initialises an instance of ByteArrayArgument.- Parameters:
type- parameter typeargumentType- argument typevalue- byte array- Throws:
IllegalArgumentException- iftypeis not valid for byte arrays, or ifvalueisnullLengthOverflowException- if the length ofvalueexceedsArgumentType.getMaxLength()
-
-
Method Details
-
writeTo
Description copied from class:ArgumentWrites the arguments to the suppliedOutputStreamin the XDR format of the type.- Specified by:
writeToin classArgument- Parameters:
outputStream- OutputStream- Throws:
IOException- For errors writing to the OutputStream
-
getLength
public int getLength()- Specified by:
getLengthin classArgument- Returns:
- Total length of the buffer item when written to the OutputStream by
Argument.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).
-
getValueAsInt
public int getValueAsInt()Description copied from interface:ParameterThe value of the parameter as int.The implementation may throw a RuntimeException if the parameter isn't an int (or shouldn't be used as an int).
- Specified by:
getValueAsIntin interfaceParameter- Overrides:
getValueAsIntin classArgument- Returns:
- The value as int
-
getValueAsBytes
public byte[] getValueAsBytes() -
copyTo
Description copied from interface:ParameterCopies this argument into the supplied buffer, uses the suppliedEncodingfor string arguments.An instance of
Parametershould know how to copy itself into another buffer (eg an instance ofStringArgumentwould know to callParameterBuffer.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 they are free to try that).
- Parameters:
buffer- ParameterBuffer instanceencoding- Encoding to use for string properties. A value ofnullcan be used to signal that the original encoding should be used.
-
transformTo
Description copied from class:ArgumentIf needed, returns a new argument to transform to a suitable argument type, otherwise returns this instance.- Specified by:
transformToin classArgument- Parameters:
parameterBufferMetaData- parameter buffer metadata (used to determine the needed argument type)- Returns:
- either a new argument if transformation is needed, or this instance
-
equals
-
hashCode
public int hashCode()
-