Example #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;
 }
Example #2
0
 public void writeBytes(byte[] bytes, int i, int i1) {
   StreamItem item = new StreamItem();
   byte[] subBytes = ByteArrays.extractSubBytes(bytes, i, i1);
   item.byteArrayValue(subBytes);
   items.add(item);
 }
Example #3
0
 public void writeBytes(byte[] bytes) {
   StreamItem item = new StreamItem();
   byte[] subBytes = ByteArrays.extractSubBytes(bytes, 0, bytes.length);
   item.byteArrayValue(subBytes);
   items.add(item);
 }