code: public synchronized Map<String, MLArray> read(InputStream stream, MatFileFilter filter) throws IOException
      {
          this.filter = filter;
  
          data.clear();
  
          ByteBuffer buf = null;
  
          final ByteArrayOutputStream2 baos = new ByteArrayOutputStream2();
          copy(stream, baos);
          buf = ByteBuffer.wrap(baos.getBuf(), 0, baos.getCount());
  
          // Do the actual work
          parseData(buf);
  
          return getContent();
      }
docs: Read a mat file from a stream. Internally this will read the stream fully
  into memory before parsing it.
  
  @param stream
  a valid MAT-file stream to be read
  @param filter
  the array filter applied during reading
  
  @return the same as <code>{@link #getContent()}</code>
  @see MatFileFilter
  @throws IOException
  if error occurs during file processing