Examples of RFC2231Encoder


Examples of org.apache.geronimo.mail.util.RFC2231Encoder

                    // is marked as being encoded, so if requested, we decode the value.
                    if (decodeParameters && name.endsWith("*")) {
                        // the name needs to be pruned of the marker, and we need to decode the value.
                        name = name.substring(0, name.length() - 1);
                        // get a new decoder
                        RFC2231Encoder decoder = new RFC2231Encoder(HeaderTokenizer.MIME);

                        try {
                            // decode the value
                            decodedValue = decoder.decode(value);
                        } catch (Exception e) {
                            // if we're doing things strictly, then raise a parsing exception for errors.
                            // otherwise, leave the value in its current state.
                            if (decodeParametersStrict) {
                                throw new ParseException("Invalid RFC2231 encoded parameter");
View Full Code Here

Examples of org.apache.geronimo.mail.util.RFC2231Encoder

        // only encode if told to and this contains non-ASCII charactes.
        if (encodeParameters && !ASCIIUtil.isAscii(value)) {
            ByteArrayOutputStream out = new ByteArrayOutputStream();

            try {
                RFC2231Encoder encoder = new RFC2231Encoder(HeaderTokenizer.MIME);

                // extract the bytes using the given character set and encode
                byte[] valueBytes = value.getBytes(MimeUtility.javaCharset(charset));

                // the string format is charset''data
                out.write(charset.getBytes());
                out.write('\'');
                out.write('\'');
                encoder.encode(valueBytes, 0, valueBytes.length, out);

                // default in case there is an exception
                _parameters.put(name, new ParameterValue(name, value, new String(out.toByteArray())));
                return;
View Full Code Here

Examples of org.apache.geronimo.mail.util.RFC2231Encoder

                    // is marked as being encoded, so if requested, we decode the value.
                    if (decodeParameters && name.endsWith("*")) {
                        // the name needs to be pruned of the marker, and we need to decode the value.
                        name = name.substring(0, name.length() - 1);
                        // get a new decoder
                        RFC2231Encoder decoder = new RFC2231Encoder(HeaderTokenizer.MIME);

                        try {
                            // decode the value
                            decodedValue = decoder.decode(value);
                        } catch (Exception e) {
                            // if we're doing things strictly, then raise a parsing exception for errors.
                            // otherwise, leave the value in its current state.
                            if (decodeParametersStrict) {
                                throw new ParseException("Invalid RFC2231 encoded parameter");
View Full Code Here

Examples of org.apache.geronimo.mail.util.RFC2231Encoder

        // only encode if told to and this contains non-ASCII charactes.
        if (encodeParameters && !ASCIIUtil.isAscii(value)) {
            ByteArrayOutputStream out = new ByteArrayOutputStream();

            try {
                RFC2231Encoder encoder = new RFC2231Encoder(HeaderTokenizer.MIME);

                // extract the bytes using the given character set and encode
                byte[] valueBytes = value.getBytes(MimeUtility.javaCharset(charset));

                // the string format is charset''data
                out.write(charset.getBytes());
                out.write('\'');
                out.write('\'');
                encoder.encode(valueBytes, 0, valueBytes.length, out);

                // default in case there is an exception
                _parameters.put(name, new ParameterValue(name, value, new String(out.toByteArray())));
                return;
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.