Examples of MimeException


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

Examples of eu.medsea.mimeutil.MimeException

   * @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

Examples of eu.medsea.mimeutil.MimeException

  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

Examples of eu.medsea.mimeutil.MimeException

    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

Examples of org.apache.james.mime4j.MimeException

                inbuffer.ensureCapacity(bufferSize);
                mimeStream = new MimeBoundaryInputStream(inbuffer, boundary);
            }
        } catch (IllegalArgumentException e) {
            // thrown when boundary is too long
            throw new MimeException(e.getMessage(), e);
        }
        dataStream = new LineReaderInputStreamAdaptor(
                mimeStream,
                config.getMaxLineLen());
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

                break;
            case MimeTokenStream.T_START_MULTIPART:
                mimeDescriptorImpl = compositePartDescriptor(parser, headers);
                break;
            case MimeTokenStream.T_END_OF_STREAM:
                throw new MimeException("Premature end of stream");
            default:
                throw new MimeException("Unexpected parse state");
        }
        return mimeDescriptorImpl;
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

        }
    }

    private void verifyEndOfStream() throws IOException {
        if (strict && eof && !atBoundary) {
            throw new MimeIOException(new MimeException("Unexpected end of stream"));
        }
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

                        break;
                    }
                }
            }
        } catch (MaxLineLimitException e) {
            throw new MimeException(e);
        }
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

        try {
            currentMimePartStream = new MimeBoundaryInputStream(inbuffer, boundary,
                    config.isStrictParsing());
        } catch (IllegalArgumentException e) {
            // thrown when boundary is too long
            throw new MimeException(e.getMessage(), e);
        }
        dataStream = new LineReaderInputStreamAdaptor(
                currentMimePartStream,
                config.getMaxLineLen());
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

            return null;
        }
        ParserCursor cursor = new ParserCursor(0, raw.length());
        String name = parseToken(raw, cursor, COLON);
        if (cursor.atEnd()) {
            throw new MimeException("Invalid MIME field: no name/value separator found: " +
                    raw.toString());
        }
        return new RawField(raw, cursor.getPos(), name, null);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.