@ Override public int readBytes ( byte [ ] value , int length ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "readBytes" , new Object [ ] { value , length } ) ; try { // Check that we are in read mode checkBodyReadable ( "readBytes" ) ; if ( requiresInit ) lazyInitForReading ( ) ; // Check that there's enough room in the byte array supplied by the application for the number of // bytes requested if ( value . length < length || length < 0 ) throw new IndexOutOfBoundsException ( ) ; // Attempt to read into the application's byte array. If there are insufficient bytes in the message readStream // then this method returns the number actually read. If we've reached the end of data, it returns -1 int result = readStream . read ( value , 0 , length ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "readBytes" , result ) ; return result ; } catch ( IOException e ) { JMSException jmse = ( JMSException ) JmsErrorUtils . newThrowable ( MessageEOFException . class , "END_BYTESMESSAGE_CWSIA0183" , null , tc ) ; jmse . initCause ( e ) ; throw jmse ; } }
Read a portion of the bytes message stream .