com.ibm.mq.data

Interface MQDataInput

All known implementing classes:
MQDataInputStream

  1. public interface MQDataInput
An MQDataInput implementation allows read access to some underlying store of semi-structured binary data. It provides read methods for character data, integer data, floating-point data, packed decimal data and serialized Java objects. It converts between different representations of this data (e.g. EBCDIC/ASCII character data, big-endian and little-endian integer data) driven by the CCSID and encoding properties. It is intended for reading WebSphere MQ message data, and uses WMQ conventions.

Field Summary

Modifier and Type Field and Description
  1. static
  2. java.lang.String
COPYRIGHT

Method Summary

Modifier and Type Method and Description
  1. int
getCCSID()
Returns the Coded Character Set Identifier currently used for character read operations
  1. int
getDataOffset()
Returns the current offset of the cursor, relative to the position where this MQDataOutput object was originally created.
  1. DecimalEncoding
getDecimalEncoding()
Returns the DecimalEncoding currently used for packed-decimal read operations.
  1. int
getEncoding()
Return the WMQ encoding identifier representing the three encodings (integer, floating-point and packed-decimal) currently used for numeric read operations.
  1. FloatEncoding
getFloatEncoding()
Returns the FloatEncoding currently used for floating-point read operations.
  1. IntegerEncoding
getIntegerEncoding()
Returns the IntegerEncoding currently used for integer read operations.
  1. byte
readByte()
Reads a single (signed) byte.
  1. byte[]
readBytes(int length)
Reads a number of (signed) bytes from the stream, returning them as an array.
  1. java.math.BigInteger
readDecimal(int length)
Reads a number of bytes as a packed-decimal integer.
  1. short
readDecimal2()
Reads two bytes as a packed-decimal integer.
  1. int
readDecimal4()
Reads four bytes as a packed-decimal integer.
  1. long
readDecimal8()
Reads eight bytes as a packed-decimal integer.
  1. double
readDouble()
Reads eight bytes as a floating-point number, interpreted according to the current floating-point encoding.
  1. float
readFloat()
Reads four bytes as a floating-point number, interpreted according to the current floating-point encoding.
  1. void
readFully(byte[] b)
Reads bytes into the parameter byte array.
  1. void
readFully(byte[] b,int off,int len)
Reads some number of bytes into a bytearray beginning from a given offset into the byte array.
  1. int
readInt()
Reads four bytes as a signed integer.
  1. long
readLong()
Reads eight bytes as a signed long integer.
  1. byte
readMQBYTE()
Reads a single (signed) byte.
  1. byte[]
readMQBYTE(int length)
Reads a number of (signed) bytes from the stream, returning them as an array.
  1. byte[]
readMQBYTE16()
Reads 16 bytes from the stream, returning them as an array.
  1. byte[]
readMQBYTE24()
Reads 24 bytes from the stream, returning them as an array.
  1. byte[]
readMQBYTE32()
Reads 32 bytes from the stream, returning them as an array.
  1. byte[]
readMQBYTE8()
Reads 8 bytes from the stream, returning them as an array.
  1. char
readMQCHAR()
Reads a single byte from the stream and converts it to a character, using the current CCSID.
  1. java.lang.String
readMQCHAR(int length)
Reads a number of bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR12()
Reads 12 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR128()
Reads 128 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR16()
Reads 16 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR20()
Reads 20 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR24()
Reads 24 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR256()
Reads 256 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR28()
Reads 28 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR32()
Reads 32 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR4()
Reads 4 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR48()
Reads 48 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR64()
Reads 64 bytes from the stream and converts them into a String, using the current CCSID.
  1. java.lang.String
readMQCHAR8()
Reads 8 bytes from the stream and converts them into a String, using the current CCSID.
  1. int
readMQINT32()
Reads four bytes as a signed integer.
  1. long
readMQINT64()
Reads eight bytes as a signed long integer.
  1. int
readMQLONG()
Reads four bytes as a signed integer.
  1. short
readMQSHORT()
Reads two bytes as a signed short.
  1. long
readMQUINT32()
Reads four bytes as an unsigned integer.
  1. java.math.BigInteger
readMQUINT64()
Reads eight bytes as an unsigned integer.
  1. long
readMQULONG()
Reads four bytes as an unsigned integer.
  1. int
readMQUSHORT()
Reads two bytes as an unsigned integer.
  1. java.lang.Object
readObject()
Reads a serialized Java Object from the stream
  1. short
readShort()
Reads two bytes as a signed short.
  1. char
readUCS2Char()
Reads two bytes from the stream and interprets it as a Unicode character.
  1. java.lang.String
readUTF()
Reads a UTF-8 encoded string from the stream.
  1. void
setCCSID(int ccsid)
Sets the Coded Character Set Identifier to be used for subsequent character read operations.
  1. void
setDecimalEncoding(DecimalEncoding de)
Sets the DecimalEncoding to be used for subsequent packed-decimal read operations.
  1. void
setEncoding(int encoding)
Sets all three encoding values - integer, floating-point and packed-decimal, using the WMQ encoding identifier.
  1. void
setFloatEncoding(FloatEncoding fe)
Sets the FloatEncoding to be used for subsequent floating-point read operations.
  1. void
setIntegerEncoding(IntegerEncoding ie)
Sets the IntegerEncoding to be uesd for subsequence integer read operations.
  1. int
skipBytes(int n)
Attempts to skip over a number of bytes, returning the number of bytes actually skipped.

Field Detail

  1. static final java.lang.String COPYRIGHT
See Also:

Method Detail

setCCSID

  1. void setCCSID(int ccsid)
  2. throws java.io.IOException
Sets the Coded Character Set Identifier to be used for subsequent character read operations.
Parameters:
ccsid - new CCSID value
Throws:
java.nio.charset.UnsupportedCharsetException - if the JDK does not support this character set
java.io.IOException

getCCSID

  1. int getCCSID()
  2. throws java.io.IOException
Returns the Coded Character Set Identifier currently used for character read operations
Returns:
current CCSID value
Throws:
java.io.IOException

setIntegerEncoding

  1. void setIntegerEncoding(IntegerEncoding ie)
  2. throws java.io.IOException
Sets the IntegerEncoding to be uesd for subsequence integer read operations. IntegerEncoding.UNDEFINED is treated as IntegerEncoding.NORMAL.
Parameters:
ie - new integer encoding value
Throws:
java.io.IOException
See Also:

getIntegerEncoding

  1. IntegerEncoding getIntegerEncoding( )
  2. throws java.io.IOException
Returns the IntegerEncoding currently used for integer read operations.
Returns:
current integer encoding
Throws:
java.io.IOException
See Also:

setFloatEncoding

  1. void setFloatEncoding(FloatEncoding fe)
  2. throws java.io.IOException
Sets the FloatEncoding to be used for subsequent floating-point read operations. FloatEncoding.UNDEFINED is treated as FloatEncoding.IEEE_NORMAL.
Parameters:
fe - new floating-point encoding value
Throws:
java.io.IOException
See Also:

getFloatEncoding

  1. FloatEncoding getFloatEncoding( )
  2. throws java.io.IOException
Returns the FloatEncoding currently used for floating-point read operations.
Returns:
current floating-point encoding
Throws:
java.io.IOException
See Also:

setDecimalEncoding

  1. void setDecimalEncoding(DecimalEncoding de)
  2. throws java.io.IOException
Sets the DecimalEncoding to be used for subsequent packed-decimal read operations. DecimalEncoding.UNDEFINED is treated as DecimalEncoding.NORMAL
Parameters:
de - new packed-decimal encoding value
Throws:
java.io.IOException
See Also:

getDecimalEncoding

  1. DecimalEncoding getDecimalEncoding( )
  2. throws java.io.IOException
Returns the DecimalEncoding currently used for packed-decimal read operations.
Returns:
current packed-decimal encoding
Throws:
java.io.IOException
See Also:

setEncoding

  1. void setEncoding(int encoding)
  2. throws java.io.IOException
Sets all three encoding values - integer, floating-point and packed-decimal, using the WMQ encoding identifier. These will be used for subsequent numeric read operations.
Parameters:
encoding - integer representation of the new encoding
Throws:
java.lang.IllegalArgumentException - if passed an unrecognised encoding identifier
java.io.IOException

getEncoding

  1. int getEncoding()
  2. throws java.io.IOException
Return the WMQ encoding identifier representing the three encodings (integer, floating-point and packed-decimal) currently used for numeric read operations.
Returns:
integer representation of the current encoding
Throws:
java.io.IOException

getDataOffset

  1. int getDataOffset()
  2. throws java.io.IOException
Returns the current offset of the cursor, relative to the position where this MQDataOutput object was originally created. Behaviour is undefined if the underlying data source has been manipulated without going through this MQDataOutput object.
Returns:
number of bytes read or skipped
Throws:
java.io.IOException

skipBytes

  1. int skipBytes(int n)
  2. throws java.io.IOException
Attempts to skip over a number of bytes, returning the number of bytes actually skipped.
Parameters:
n - number of bytes to attempt to skip
Returns:
number of bytes actually skipped; 0 if at the end of the stream.
Throws:
java.io.IOException
See Also:
DataInput.skipBytes(int)

readByte

  1. byte readByte()
  2. throws java.io.IOException
Reads a single (signed) byte.
Returns:
byte read from stream
Throws:
java.io.EOFException - if at the end of the stream
java.io.IOException

readBytes

  1. byte[] readBytes(int length)
  2. throws java.io.IOException
Reads a number of (signed) bytes from the stream, returning them as an array.
Parameters:
length - number of bytes to read
Returns:
an array containing the read bytes
Throws:
java.io.EOFException - if at the end of the stream
java.io.IOException

readMQBYTE

  1. byte readMQBYTE()
  2. throws java.io.IOException
Reads a single (signed) byte.
Returns:
byte read from stream
Throws:
java.io.EOFException - if at the end of the stream
java.io.IOException

readMQBYTE

  1. byte[] readMQBYTE(int length)
  2. throws java.io.IOException
Reads a number of (signed) bytes from the stream, returning them as an array.
Parameters:
length - number of bytes to read
Returns:
an array containing the read bytes
Throws:
java.io.EOFException - if at the end of the stream
java.io.IOException

readMQBYTE8

  1. byte[] readMQBYTE8()
  2. throws java.io.IOException
Reads 8 bytes from the stream, returning them as an array.
Returns:
an array containing the read bytes
Throws:
java.io.EOFException - if at the end of the stream
java.io.IOException

readMQBYTE16

  1. byte[] readMQBYTE16()
  2. throws java.io.IOException
Reads 16 bytes from the stream, returning them as an array.
Returns:
an array containing the read bytes
Throws:
java.io.EOFException - if at the end of the stream
java.io.IOException

readMQBYTE24

  1. byte[] readMQBYTE24()
  2. throws java.io.IOException
Reads 24 bytes from the stream, returning them as an array.
Returns:
an array containing the read bytes
Throws:
java.io.EOFException - if at the end of the stream
java.io.IOException

readMQBYTE32

  1. byte[] readMQBYTE32()
  2. throws java.io.IOException
Reads 32 bytes from the stream, returning them as an array.
Returns:
an array containing the read bytes
Throws:
java.io.EOFException - if at the end of the stream
java.io.IOException

readFully

  1. void readFully(byte[] b)
  2. throws java.io.IOException
Reads bytes into the parameter byte array.
Parameters:
b - byte array to read into
Throws:
java.lang.NullPointerException - if b is null
java.io.EOFException - if the stream does not have enough data left to fill the byte array
java.io.IOException
See Also:
DataInput.readFully(byte[])

readFully

  1. void readFully(byte[] b,
  2. int off,
  3. int len)
  4. throws java.io.IOException
Reads some number of bytes into a bytearray beginning from a given offset into the byte array.
Parameters:
b - byte array to read into
off - starting index in the byte array
len - number of bytes to read
Throws:
java.lang.NullPointerException - if b is null
java.lang.IndexOutOfBoundsException - if off is negative, len is negative, or off+len is greater than the length of b
java.io.EOFException - if the stream ends before len bytes have been read
java.io.IOException
See Also:
DataInput.readFully(byte[], int, int)

readMQCHAR

  1. char readMQCHAR()
  2. throws java.io.IOException
Reads a single byte from the stream and converts it to a character, using the current CCSID. Fails if the next byte in the stream does not completely represent a single character.
Returns:
a byte from the stream as a character
Throws:
java.io.EOFException - at end of stream
java.io.IOException - if the next byte does not completely represent a single character, or for unexpected errors.

readMQCHAR

  1. java.lang.String readMQCHAR(int length)
  2. throws java.io.IOException
Reads a number of bytes from the stream and converts them into a String, using the current CCSID.
Parameters:
length - number of bytes to read
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR4

  1. java.lang.String readMQCHAR4()
  2. throws java.io.IOException
Reads 4 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR8

  1. java.lang.String readMQCHAR8()
  2. throws java.io.IOException
Reads 8 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR12

  1. java.lang.String readMQCHAR12()
  2. throws java.io.IOException
Reads 12 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR16

  1. java.lang.String readMQCHAR16()
  2. throws java.io.IOException
Reads 16 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR20

  1. java.lang.String readMQCHAR20()
  2. throws java.io.IOException
Reads 20 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR24

  1. java.lang.String readMQCHAR24()
  2. throws java.io.IOException
Reads 24 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR28

  1. java.lang.String readMQCHAR28()
  2. throws java.io.IOException
Reads 28 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR32

  1. java.lang.String readMQCHAR32()
  2. throws java.io.IOException
Reads 32 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR48

  1. java.lang.String readMQCHAR48()
  2. throws java.io.IOException
Reads 48 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR64

  1. java.lang.String readMQCHAR64()
  2. throws java.io.IOException
Reads 64 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR128

  1. java.lang.String readMQCHAR128( )
  2. throws java.io.IOException
Reads 128 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readMQCHAR256

  1. java.lang.String readMQCHAR256( )
  2. throws java.io.IOException
Reads 256 bytes from the stream and converts them into a String, using the current CCSID.
Returns:
String read from the stream
Throws:
java.nio.charset.CharacterCodingException - if conversion fails
java.io.EOFException - at end of stream
java.io.IOException

readUCS2Char

  1. char readUCS2Char()
  2. throws java.io.IOException
Reads two bytes from the stream and interprets it as a Unicode character. The byte-order is determined by the current integer encoding.
Returns:
a character read from the stream
Throws:
java.io.EOFException - at end of stream
java.io.IOException

readUTF

  1. java.lang.String readUTF()
  2. throws java.io.IOException
Reads a UTF-8 encoded string from the stream. The first two bytes of the stream give the length of the string. This is compatible with DataInput.writeUTF().
Returns:
a String, read from the stream
Throws:
java.io.EOFException - at end of stream
java.io.UTFDataFormatException - if the stream does not contain a valid UTF-8 string
java.io.IOException
See Also:
DataInput.readUTF()

readShort

  1. short readShort()
  2. throws java.io.IOException
Reads two bytes as a signed short. The byte order is determined by the current integer encoding.
Returns:
the read short
Throws:
java.io.EOFException - at end of stream
java.io.IOException
See Also:
DataInput.readShort()

readMQSHORT

  1. short readMQSHORT()
  2. throws java.io.IOException
Reads two bytes as a signed short. The byte order is determined by the current integer encoding.
Returns:
the read short
Throws:
java.io.EOFException - at end of stream
java.io.IOException

readMQUSHORT

  1. int readMQUSHORT()
  2. throws java.io.IOException
Reads two bytes as an unsigned integer. The byte order is determined by the current integer encoding.
Returns:
a two-byte unsigned integer, as an int
Throws:
java.io.EOFException - at end of stream
java.io.IOException

readInt

  1. int readInt()
  2. throws java.io.IOException
Reads four bytes as a signed integer. The byte order is determined by the current integer encoding.
Returns:
the read int
Throws:
java.io.EOFException - at end of stream
java.io.IOException
See Also:
DataInput.readInt()

readMQLONG

  1. int readMQLONG()
  2. throws java.io.IOException
Reads four bytes as a signed integer. The byte order is determined by the current integer encoding.
Returns:
the read int
Throws:
java.io.EOFException - at end of stream
java.io.IOException

readMQULONG

  1. long readMQULONG()
  2. throws java.io.IOException
Reads four bytes as an unsigned integer. The byte order is determined by the current integer encoding.
Returns:
a four-byte unsigned integer, as a long
Throws:
java.io.EOFException - at end of stream
java.io.IOException

readMQINT32

  1. int readMQINT32()
  2. throws java.io.IOException
Reads four bytes as a signed integer. The byte order is determined by the current integer encoding.
Returns:
the read int
Throws:
java.io.EOFException - at end of stream
java.io.IOException

readMQUINT32

  1. long readMQUINT32()
  2. throws java.io.IOException
Reads four bytes as an unsigned integer. The byte order is determined by the current integer encoding.
Returns:
a four-byte unsigned integer, as a long
Throws:
java.io.EOFException - at end of stream
java.io.IOException

readLong

  1. long readLong()
  2. throws java.io.IOException
Reads eight bytes as a signed long integer. The byte order is determined by the current integer encoding.
Returns:
the read long
Throws:
java.io.EOFException - at end of stream
java.io.IOException
See Also:
DataInput.readLong()

readMQINT64

  1. long readMQINT64()
  2. throws java.io.IOException
Reads eight bytes as a signed long integer. The byte order is determined by the current integer encoding.
Returns:
the read long
Throws:
java.io.EOFException - at end of stream
java.io.IOException

readMQUINT64

  1. java.math.BigInteger readMQUINT64( )
  2. throws java.io.IOException
Reads eight bytes as an unsigned integer. The byte order is determined by the current integer encoding.
Returns:
an eight-byte unsigned integer, as a BigInteger
Throws:
java.io.EOFException - at end of stream
java.io.IOException

readFloat

  1. float readFloat()
  2. throws java.io.IOException
Reads four bytes as a floating-point number, interpreted according to the current floating-point encoding. If the S390 encoding is used, this is the short HFP format. Note that conversion from this format to a Java float may lose precision.
Returns:
a four-byte precision floating point number.
Throws:
java.io.EOFException - at end of stream
java.io.IOException
See Also:
DataInput.readFloat()

readDouble

  1. double readDouble()
  2. throws java.io.IOException
Reads eight bytes as a floating-point number, interpreted according to the current floating-point encoding. If the S390 encoding is used, this is the long HFP format. Note that conversion from this format to a Java double may lose precision.
Returns:
an eight-byte precision floating point number.
Throws:
java.io.EOFException - at end of stream
java.io.IOException
See Also:
DataInput.readFloat()

readDecimal

  1. java.math.BigInteger readDecimal( int length)
  2. throws java.io.IOException
Reads a number of bytes as a packed-decimal integer. The current packed-decimal encoding determines the byte order.

Unsigned packed-decimals are treated as positive; this method cannot distinguish between positive and negative zero.

Parameters:
length - number of bytes to read
Returns:
the read packed-decimal number, as a BigInteger.
Throws:
java.io.EOFException - at end of stream
java.io.IOException - if a malformed packed-decimal is encountered, or for other error.

readDecimal2

  1. short readDecimal2()
  2. throws java.io.IOException
Reads two bytes as a packed-decimal integer. The current packed-decimal encoding determines the byte order.

Unsigned packed-decimals are treated as positive; this method cannot distinguish between positive and negative zero.

Returns:
the read packed-decimal number, as a short, between -999 and 999 inclusive.
Throws:
java.io.EOFException - at end of stream
java.io.IOException - if a malformed packed-decimal is encountered, or for other error.

readDecimal4

  1. int readDecimal4()
  2. throws java.io.IOException
Reads four bytes as a packed-decimal integer. The current packed-decimal encoding determines the byte order.

Unsigned packed-decimals are treated as positive; this method cannot distinguish between positive and negative zero.

Returns:
the read packed-decimal number, as an int, between -9999999 and 9999999 inclusive.
Throws:
java.io.EOFException - at end of stream
java.io.IOException - if a malformed packed-decimal is encountered, or for other error.

readDecimal8

  1. long readDecimal8()
  2. throws java.io.IOException
Reads eight bytes as a packed-decimal integer. The current packed-decimal encoding determines the byte order.

Unsigned packed-decimals are treated as positive; this method cannot distinguish between positive and negative zero.

Returns:
the read packed-decimal number, as a long, between -1015 and 1015 exclusive
Throws:
java.io.EOFException - at end of stream
java.io.IOException - if a malformed packed-decimal is encountered, or for other error.

readObject

  1. java.lang.Object readObject()
  2. throws java.io.IOException
  3. java.lang.ClassNotFoundException
Reads a serialized Java Object from the stream
Returns:
a deserialized Object.
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
ObjectInput.readObject()