Package org.apache.james.mime4j.parser

Examples of org.apache.james.mime4j.parser.MimeEntityConfig


        BasicConfigurator.resetConfiguration();
        BasicConfigurator.configure();
    }
  
    protected void runTest() throws Throwable {
        MimeEntityConfig config = new MimeEntityConfig();
        config.setMaxLineLen(-1);
        Message inputMessage = new Message(new FileInputStream(file), config);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        inputMessage.writeTo(out, MessageUtils.LENIENT);
       
        String msgoutFile = file.getAbsolutePath().substring(0, file.getAbsolutePath().lastIndexOf('.')) + ".out";
View Full Code Here


        File f = file;
        String fileName = file.getAbsolutePath();
       
        System.out.println("Parsing " + f.getName());
       
        MimeEntityConfig config = new MimeEntityConfig();
        config.setMaxLineLen(-1);
        Message m = new Message(new FileInputStream(f), config);
       
        String prefix = f.getName().substring(0, f.getName().length() - 4);
        String xmlFileName = fileName.substring(0, fileName.length() - 4)
                                    + "_decoded.xml";
View Full Code Here

                    }
                   
                }
            }
        };
        MimeEntityConfig config = new MimeEntityConfig();
        config.setMaxLineLen(-1);
        //config.setStrictParsing(false);
        config.setMaxContentLen(-1);
        MimeStreamParser parser = new MimeStreamParser(config);
        parser.setContentHandler(handler);
      
        try {
            // parse the message to index headers and body
View Full Code Here

            bodyStartOctet = bodyStartOctet(tmpMsgIn);

            // Disable line length... This should be handled by the smtp server
            // component and not the parser itself
            // https://issues.apache.org/jira/browse/IMAP-122
            MimeEntityConfig config = new MimeEntityConfig();
            config.setMaximalBodyDescriptor(true);
            config.setMaxLineLen(-1);
            final ConfigurableMimeTokenStream parser = new ConfigurableMimeTokenStream(config);

            parser.setRecursionMode(MimeTokenStream.M_NO_RECURSE);
            parser.parse(tmpMsgIn.newStream(0, -1));
View Full Code Here

            tmpMsgIn = new TeeInputStream(msgIn, out);
          
            bIn = new BodyOffsetInputStream(tmpMsgIn);
            // Disable line length... This should be handled by the smtp server component and not the parser itself
            // https://issues.apache.org/jira/browse/IMAP-122
            MimeEntityConfig config = new MimeEntityConfig();
            config.setMaximalBodyDescriptor(true);
            config.setMaxLineLen(-1);
            final ConfigurableMimeTokenStream parser = new ConfigurableMimeTokenStream(config);
          
            parser.setRecursionMode(MimeTokenStream.M_NO_RECURSE);
            parser.parse(bIn);
            final Header header = new Header();
View Full Code Here

    private boolean empty = false;

    private boolean topLevel = true;

    public PartContentBuilder() {
        MimeEntityConfig config = new MimeEntityConfig();
        config.setMaxLineLen(-1);

        parser = new ConfigurableMimeTokenStream(config);
    }
View Full Code Here

    private boolean parse(final InputStream input,
            final boolean isCaseInsensitive, final boolean includeHeaders,
            final CharBuffer buffer) throws IOException, MimeException {
        try {
            boolean result = false;
            MimeEntityConfig config = new MimeEntityConfig();
            config.setMaxLineLen(-1);

            ConfigurableMimeTokenStream parser = new ConfigurableMimeTokenStream(config);            parser.parse(input);
            while (!result && parser.next() != MimeTokenStream.T_END_OF_STREAM) {
                final int state = parser.getState();
                switch (state) {
View Full Code Here

    static final Charset US_ASCII = Charset.forName("US-ASCII");

    public static List<MessageResult.Header> createHeaders(final Message<?> document) throws IOException {
        final List<MessageResult.Header> results = new ArrayList<MessageResult.Header>();
        MimeEntityConfig config = new MimeEntityConfig();
        config.setMaxLineLen(-1);
        final MimeStreamParser parser = new MimeStreamParser(config);
        parser.setContentHandler(new AbstractContentHandler() {
            @Override
            public void endHeader() {
                parser.stop();
View Full Code Here

    }

    public static MimeDescriptorImpl build(final InputStream stream) throws IOException, MimeException {
        // Disable line length limit
        // See https://issues.apache.org/jira/browse/IMAP-132
        MimeEntityConfig config = new MimeEntityConfig();
        config.setMaximalBodyDescriptor(true);
        config.setMaxLineLen(-1);
        final ConfigurableMimeTokenStream parser = new ConfigurableMimeTokenStream(config);

        parser.parse(stream);
        parser.setRecursionMode(RecursionMode.M_NO_RECURSE);
        return createDescriptor(parser);
View Full Code Here

        protected MyMimeTokenStream() {
            super(getConfig());
        }

        private static MimeEntityConfig getConfig() {
            MimeEntityConfig config = new MimeEntityConfig();
            config.setMaxLineLen(MAX_LINE_LENGTH);
            return config;
        }
View Full Code Here

TOP

Related Classes of org.apache.james.mime4j.parser.MimeEntityConfig

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.