/** * Constructor that takes a ContentDisposition string. The String * is parsed into its constituents: dispostion and parameters. * A ParseException is thrown if the parse fails. * * @param s the ContentDisposition string. * @exception ParseException if the parse fails. * @since JavaMail 1.2 */ public ContentDisposition(String s) throws ParseException { HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME); HeaderTokenizer.Token tk; // First "disposition" .. tk = h.next(); if (tk.getType() != HeaderTokenizer.Token.ATOM) throw new ParseException("Expected disposition, got " + tk.getValue()); disposition = tk.getValue(); // Then parameters .. String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem); }
String rem = h.getRemainder(); if (rem != null) { try {
String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem);
String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem);
public ContentDisposition(String disposition) throws ParseException { // get a token parser for the type information HeaderTokenizer tokenizer = new HeaderTokenizer(disposition, HeaderTokenizer.MIME); // get the first token, which must be an ATOM HeaderTokenizer.Token token = tokenizer.next(); if (token.getType() != HeaderTokenizer.Token.ATOM) { throw new ParseException("Invalid content disposition"); } _disposition = token.getValue(); // the remainder is parameters, which ParameterList will take care of parsing. String remainder = tokenizer.getRemainder(); if (remainder != null) { _list = new ParameterList(remainder); } }
public ContentDisposition(String disposition) throws ParseException { // get a token parser for the type information HeaderTokenizer tokenizer = new HeaderTokenizer(disposition, HeaderTokenizer.MIME); // get the first token, which must be an ATOM HeaderTokenizer.Token token = tokenizer.next(); if (token.getType() != HeaderTokenizer.Token.ATOM) { throw new ParseException("Invalid content disposition"); } _disposition = token.getValue(); // the remainder is parameters, which ParameterList will take care of parsing. String remainder = tokenizer.getRemainder(); if (remainder != null) { _list = new ParameterList(remainder); } }
/** * Constructor that takes a ContentDisposition string. The String * is parsed into its constituents: dispostion and parameters. * A ParseException is thrown if the parse fails. * * @param s the ContentDisposition string. * @exception ParseException if the parse fails. * @since JavaMail 1.2 */ public ContentDisposition(String s) throws ParseException { HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME); HeaderTokenizer.Token tk; // First "disposition" .. tk = h.next(); if (tk.getType() != HeaderTokenizer.Token.ATOM) throw new ParseException(); disposition = tk.getValue(); // Then parameters .. String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem); }
/** * Constructor that takes a ContentDisposition string. The String * is parsed into its constituents: dispostion and parameters. * A ParseException is thrown if the parse fails. * * @param s the ContentDisposition string. * @exception ParseException if the parse fails. * @since JavaMail 1.2 */ public ContentDisposition(String s) throws ParseException { HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME); HeaderTokenizer.Token tk; // First "disposition" .. tk = h.next(); if (tk.getType() != HeaderTokenizer.Token.ATOM) throw new ParseException("Expected disposition, got " + tk.getValue()); disposition = tk.getValue(); // Then parameters .. String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem); }
String rem = h.getRemainder(); if (rem != null) { try {
String rem = h.getRemainder(); if (rem != null) { try {
String rem = h.getRemainder(); if (rem != null) { try {
String rem = h.getRemainder(); if (rem != null) { try {
String rem = h.getRemainder(); if (rem != null) { try {
public ContentType(String type) throws ParseException { // get a token parser for the type information HeaderTokenizer tokenizer = new HeaderTokenizer(type, HeaderTokenizer.MIME); // get the first token, which must be an ATOM HeaderTokenizer.Token token = tokenizer.next(); if (token.getType() != HeaderTokenizer.Token.ATOM) { throw new ParseException("Invalid content type"); } _major = token.getValue(); // the MIME type must be major/minor token = tokenizer.next(); if (token.getType() != '/') { throw new ParseException("Invalid content type"); } // this must also be an atom. Content types are not permitted to be wild cards. token = tokenizer.next(); if (token.getType() != HeaderTokenizer.Token.ATOM) { throw new ParseException("Invalid content type"); } _minor = token.getValue(); // the remainder is parameters, which ParameterList will take care of parsing. String remainder = tokenizer.getRemainder(); if (remainder != null) { _list = new ParameterList(remainder); } }
public ContentType(String type) throws ParseException { // get a token parser for the type information HeaderTokenizer tokenizer = new HeaderTokenizer(type, HeaderTokenizer.MIME); // get the first token, which must be an ATOM HeaderTokenizer.Token token = tokenizer.next(); if (token.getType() != HeaderTokenizer.Token.ATOM) { throw new ParseException("Invalid content type"); } _major = token.getValue(); // the MIME type must be major/minor token = tokenizer.next(); if (token.getType() != '/') { throw new ParseException("Invalid content type"); } // this must also be an atom. Content types are not permitted to be wild cards. token = tokenizer.next(); if (token.getType() != HeaderTokenizer.Token.ATOM) { throw new ParseException("Invalid content type"); } _minor = token.getValue(); // the remainder is parameters, which ParameterList will take care of parsing. String remainder = tokenizer.getRemainder(); if (remainder != null) { _list = new ParameterList(remainder); } }
/** * Constructor that takes a Content-Type string. The String * is parsed into its constituents: primaryType, subType * and parameters. A ParseException is thrown if the parse fails. * * @param s the Content-Type string. * @exception ParseException if the parse fails. */ public ContentType(String s) throws ParseException { HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME); HeaderTokenizer.Token tk; // First "type" .. tk = h.next(); if (tk.getType() != HeaderTokenizer.Token.ATOM) throw new ParseException(); primaryType = tk.getValue(); // The '/' separator .. tk = h.next(); if ((char)tk.getType() != '/') throw new ParseException(); // Then "subType" .. tk = h.next(); if (tk.getType() != HeaderTokenizer.Token.ATOM) throw new ParseException(); subType = tk.getValue(); // Finally parameters .. String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem); }
String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem);
String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem);
String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem);
String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem);