Ejemplo n.º 1
0
 public int readBytes(byte[] bytes) throws MessageFormatException, MessageEOFException {
   checkEndOfStreamCondition();
   if (bytes == null) return -1;
   final StreamItem streamItem = items.get(mark);
   final byte[] bytes1 = StreamItemConversion.convertToByteArray(streamItem);
   if (byteArrayReadingInProgress && byteArrayMark == bytes1.length) {
     endByteArrayReading();
     return -1;
   }
   byteArrayReadingInProgress = true;
   final int filled = ByteArrays.fillByteArray(bytes1, byteArrayMark, bytes);
   byteArrayMark += filled;
   if (byteArrayMark == bytes1.length && filled < bytes.length) {
     endByteArrayReading();
   }
   return filled;
 }