Package org.firebirdsql.gds.impl
Class ParameterBufferBase
- java.lang.Object
- 
- org.firebirdsql.gds.impl.ParameterBufferBase
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Iterable<Parameter>,- ParameterBuffer
 - Direct Known Subclasses:
- BlobParameterBufferImp,- DatabaseParameterBufferImp,- ServiceParameterBufferImp,- ServiceRequestBufferImp,- TransactionParameterBufferImpl
 
 public abstract class ParameterBufferBase extends java.lang.Object implements ParameterBuffer, java.io.Serializable Base class for parameter buffers- Author:
- Mark Rotteveel
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedParameterBufferBase(ParameterBufferMetaData parameterBufferMetaData)Creates aParameterBufferBase.protectedParameterBufferBase(ParameterBufferMetaData parameterBufferMetaData, Encoding defaultEncoding)Creates aParameterBufferBase.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArgument(int argumentType)Add argument with no parameters.voidaddArgument(int type, byte[] content)Add array of bytes.voidaddArgument(int argumentType, int value)Add integer argument.voidaddArgument(int argumentType, long value)Add long argument.voidaddArgument(int argumentType, java.lang.String value)Add string argument with the default encoding.voidaddArgument(int argumentType, java.lang.String value, Encoding encoding)Add string argument.booleanequals(java.lang.Object other)intgetArgumentAsInt(int type)Get argument as int.java.lang.StringgetArgumentAsString(int type)Get argument as string.protected java.util.List<Argument>getArgumentsList()EncodinggetDefaultEncoding()protected intgetLength()ParameterBufferMetaDatagetParameterBufferMetaData()intgetType()booleanhasArgument(int type)Check if this parameter buffer has specified argument.inthashCode()java.util.Iterator<Parameter>iterator()Returns an iterator over a copy of the parameters in this parameter buffer.voidremoveArgument(int type)Remove specified argument.intsize()byte[]toBytes()Converts this parameter buffer to a byte array.byte[]toBytesWithType()Converts this parameter buffer to a byte array with type information.XdrabletoXdrable()voidwriteArgumentsTo(java.io.OutputStream outputStream)Writes the arguments in the implementation specific serialization into theOutputStream.
 
- 
- 
- 
Constructor Detail- 
ParameterBufferBaseprotected ParameterBufferBase(ParameterBufferMetaData parameterBufferMetaData) Creates aParameterBufferBase.This uses a default encoding derived from the system default encoding. You usually want to use ParameterBufferBase(ParameterBufferMetaData, Encoding)instead.- Parameters:
- parameterBufferMetaData- Metadata for the parameter buffer.
 
 - 
ParameterBufferBaseprotected ParameterBufferBase(ParameterBufferMetaData parameterBufferMetaData, Encoding defaultEncoding) Creates aParameterBufferBase.- Parameters:
- parameterBufferMetaData- Metadata for the parameter buffer.
- defaultEncoding- Default encoding to use for string arguments
 
 
- 
 - 
Method Detail- 
getDefaultEncodingpublic final Encoding getDefaultEncoding() 
 - 
getParameterBufferMetaDatapublic final ParameterBufferMetaData getParameterBufferMetaData() 
 - 
getTypepublic final int getType() - Specified by:
- getTypein interface- ParameterBuffer
- Returns:
- The parameter buffer type identifier
 
 - 
addArgumentpublic final void addArgument(int argumentType, java.lang.String value)Description copied from interface:ParameterBufferAdd string argument with the default encoding.- Specified by:
- addArgumentin interface- ParameterBuffer
- Parameters:
- argumentType- type of argument.
- value- string value to add.
 
 - 
addArgumentpublic final void addArgument(int argumentType, java.lang.String value, Encoding encoding)Description copied from interface:ParameterBufferAdd string argument.- Specified by:
- addArgumentin interface- ParameterBuffer
- Parameters:
- argumentType- type of argument.
- value- string value to add.
- encoding- encoding to use for conversion to bytes
 
 - 
addArgumentpublic final void addArgument(int argumentType, int value)Description copied from interface:ParameterBufferAdd integer argument.- Specified by:
- addArgumentin interface- ParameterBuffer
- Parameters:
- argumentType- type of argument.
- value- integer value to add.
 
 - 
addArgumentpublic final void addArgument(int argumentType, long value)Description copied from interface:ParameterBufferAdd long argument.- Specified by:
- addArgumentin interface- ParameterBuffer
- Parameters:
- argumentType- type of argument.
- value- long value to add.
 
 - 
addArgumentpublic final void addArgument(int argumentType) Description copied from interface:ParameterBufferAdd argument with no parameters.- Specified by:
- addArgumentin interface- ParameterBuffer
- Parameters:
- argumentType- type of argument.
 
 - 
addArgumentpublic final void addArgument(int type, byte[] content)Description copied from interface:ParameterBufferAdd array of bytes.- Specified by:
- addArgumentin interface- ParameterBuffer
- Parameters:
- type- type of argument.
- content- content of argument.
 
 - 
getArgumentAsStringpublic final java.lang.String getArgumentAsString(int type) Description copied from interface:ParameterBufferGet argument as string.- Specified by:
- getArgumentAsStringin interface- ParameterBuffer
- Parameters:
- type- type of argument to find.
- Returns:
- argument as string or nullif nothing found.
 
 - 
getArgumentAsIntpublic final int getArgumentAsInt(int type) Description copied from interface:ParameterBufferGet argument as int.- Specified by:
- getArgumentAsIntin interface- ParameterBuffer
- Parameters:
- type- type of argument to find.
- Returns:
- argument as string or 0if nothing found.
 
 - 
hasArgumentpublic final boolean hasArgument(int type) Description copied from interface:ParameterBufferCheck if this parameter buffer has specified argument.- Specified by:
- hasArgumentin interface- ParameterBuffer
- Parameters:
- type- type of argument to find.
- Returns:
- trueif this buffer contains specified argument.
 
 - 
removeArgumentpublic final void removeArgument(int type) Description copied from interface:ParameterBufferRemove specified argument.- Specified by:
- removeArgumentin interface- ParameterBuffer
- Parameters:
- type- type of argument to remove.
 
 - 
iteratorpublic final java.util.Iterator<Parameter> iterator() Description copied from interface:ParameterBufferReturns an iterator over a copy of the parameters in this parameter buffer.It is safe to iterate over this iterator while modifying the parameter buffer. Changes will not be reflected in the iterator. - Specified by:
- iteratorin interface- java.lang.Iterable<Parameter>
- Specified by:
- iteratorin interface- ParameterBuffer
- Returns:
- Iterator over the parameters in this parameter buffer.
 
 - 
writeArgumentsTopublic final void writeArgumentsTo(java.io.OutputStream outputStream) throws java.io.IOExceptionDescription copied from interface:ParameterBufferWrites the arguments in the implementation specific serialization into theOutputStream.- Specified by:
- writeArgumentsToin interface- ParameterBuffer
- Parameters:
- outputStream- The- OutputStreamto write to
- Throws:
- java.io.IOException- Errors produced by the output stream during writes
 
 - 
toXdrablepublic final Xdrable toXdrable() - Specified by:
- toXdrablein interface- ParameterBuffer
- Returns:
- Xdrableto write (and optionally read) this instance as Xdr.
 
 - 
getLengthprotected final int getLength() 
 - 
getArgumentsListprotected final java.util.List<Argument> getArgumentsList() 
 - 
toBytespublic final byte[] toBytes() Description copied from interface:ParameterBufferConverts this parameter buffer to a byte array.This byte array includes the extra header-bytes (if any), but does not include the type information - Specified by:
- toBytesin interface- ParameterBuffer
- Returns:
- Byte array with serialization of this parameter buffer
- See Also:
- ParameterBuffer.toBytesWithType()
 
 - 
toBytesWithTypepublic final byte[] toBytesWithType() Description copied from interface:ParameterBufferConverts this parameter buffer to a byte array with type information.This byte array includes the type information and the extra header bytes (if any). - Specified by:
- toBytesWithTypein interface- ParameterBuffer
- Returns:
- Byte array with serialization of this parameter buffer
- See Also:
- ParameterBuffer.toBytes()
 
 - 
sizepublic final int size() - Specified by:
- sizein interface- ParameterBuffer
- Returns:
- the number of parameters stored.
 
 - 
equalspublic final boolean equals(java.lang.Object other) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic final int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 
- 
 
-