humble-video-noarch/src/main/java/io/humble/video/customio/DataInputOutputHandler.java
public int read(byte[] buf, int size)
  {
    int ret = -1;
    if (mOpenStream == null || !(mOpenStream instanceof DataInput))
      return -1;

    try
    {
      if (mOpenStream instanceof RandomAccessFile) {
        RandomAccessFile file = (RandomAccessFile) mOpenStream;
        return file.read(buf, 0, size);
      } else if (mOpenStream instanceof DataInputStream) {
        DataInputStream stream = (DataInputStream) mOpenStream;
        return stream.read(buf, 0, size);
      } else {
        DataInput input = (DataInput) mOpenStream;
        try {
          input.readFully(buf, 0, size);
          ret = size;
        } catch (EOFException e) {
          // man; we have no idea how many bytes were actually
          // read now... so we truncate the data
          // what a sucky interface!
          ret = -1;
        }
        return ret;
      }
    }
    catch (IOException e)
    {
      log.error("Got IO exception reading from channel: {}; {}",
          mOpenStream, e);
      return -1;
    }
  }
public int read(byte[] buf, int size)
  {
    int ret = -1;
    if (mOpenStream == null || !(mOpenStream instanceof DataInput))
      return -1;

    try
    {
      if (mOpenStream instanceof RandomAccessFile) {
        RandomAccessFile file = (RandomAccessFile) mOpenStream;
        return file.read(buf, 0, size);
      } else if (mOpenStream instanceof DataInputStream) {
        DataInputStream stream = (DataInputStream) mOpenStream;
        return stream.read(buf, 0, size);
      } else {
        DataInput input = (DataInput) mOpenStream;
        try {
          input.readFully(buf, 0, size);
          ret = size;
        } catch (EOFException e) {
          // man; we have no idea how many bytes were actually
          // read now... so we truncate the data
          // what a sucky interface!
          ret = -1;
        }
        return ret;
      }
    }
    catch (IOException e)
    {
      log.error("Got IO exception reading from channel: {}; {}",
          mOpenStream, e);
      return -1;
    }
  }
{@inheritDoc}