code: protected MediaType getBinaryResourceMediaType(final FedoraResource resource) {
          try {
              return MediaType.valueOf(((FedoraBinary) resource).getMimeType());
          } catch (final IllegalArgumentException e) {
              LOGGER.warn("Syntactically incorrect MediaType encountered on resource {}: '{}'",
                      resource.getPath(), ((FedoraBinary)resource).getMimeType());
              return MediaType.APPLICATION_OCTET_STREAM_TYPE;
          }
      }
docs: This method returns a MediaType for a binary resource.
  If the resource's media type is syntactically incorrect, it will
  return 'application/octet-stream' as the media type.
  @param  resource the fedora resource
  @return the media type of of a binary resource