Package eu.medsea.mimeutil

Examples of eu.medsea.mimeutil.MimeException


   * @return major component of the mime type
   * @throws MimeException if you pass in an invalid mime type structure
   */
  public static String getMajorComponent(String mimeType) throws MimeException {
    if(mimeType == null) {
      throw new MimeException("Invalid MimeType [" + mimeType + "].");
    }
    String [] parts = mimeSplitter.split(mimeType);
    if(parts.length < 2) {
      throw new MimeException("Invalid MimeType [" + mimeType + "].");
    }
    return parts[0].trim();
  }
View Full Code Here


   * @return minor component of the mime type
   * @throws MimeException if you pass in an invalid mime type structure
   */
  public static String getMinorComponent(String mimeType) throws MimeException{
    if(mimeType == null) {
      throw new MimeException("Invalid MimeType [" + mimeType + "].");
    }
    String [] parts = mimeSplitter.split(mimeType);
    if(parts.length < 2) {
      throw new MimeException("Invalid MimeType [" + mimeType + "].");
    }
    return parts[1].trim();
  }
View Full Code Here

  public Collection getMimeTypesURL(final URL url) throws UnsupportedOperationException {
    InputStream in = null;
    try {
      return getMimeTypesInputStream(in = new BufferedInputStream(MimeUtil.getInputStreamForURL(url)));
    }catch(Exception e) {
      throw new MimeException(e);
    }finally {
      closeStream(in);
    }
  }
View Full Code Here

    try {
      return getMimeTypesInputStream(in = new BufferedInputStream(new FileInputStream(file)));
    }catch(FileNotFoundException e) {
      throw new UnsupportedOperationException(e.getLocalizedMessage());
    }catch(Exception e) {
      throw new MimeException(e);
    }finally {
      closeStream(in);
    }
  }
View Full Code Here

TOP

Related Classes of eu.medsea.mimeutil.MimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.