>From your description, I guess you have traced into MimeType#match(String) to see that it instantiates a MimeType so it can call MimeType#match(MimeType), right? If that is the case, it seems to me that something that will speed execution without worrying about the actual logic in the call is to create class variables for the types we always compare against:
private static final MimeType MT_APPLICATION_OCTET_STREAM = new MimeType("application/octet-stream"); if (ctype.match(MT_APPLICATION_OCTET_STREAM) ... Scott Nichol ----- Original Message ----- From: "Pavel Ausianik" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 05, 2002 10:55 AM Subject: Question: MimeType usage > Hi, > > > Need an advice of expert on MymeTypes. We have a code in the lib, which > could save around 2% of time in class org.apache.soap.rpc.SOAPContext method > addBodyPart. > > MimeType ctype = new MimeType(dh.getContentType()); > part.setHeader(Constants.HEADER_CONTENT_TYPE, > ctype.toString()); > .... > > if (ctype.match("application/octet-stream") || > ctype.match("image/*") || > ctype.match("audio/*") || > ctype.match("video/*")) > > > Unfortunately match method requres create additional MimeType instances and > scan over String > > Will be this code fragment safe to rewrite as follows: > > String ctype = dh.getContentType()) > part.setHeader(Constants.HEADER_CONTENT_TYPE, > ctype); > .... > > if (ctype.equals("application/octet-stream") || > ctype.equals("image/*") || // or maybe > ctype.startsWith("image/" > ctype.equals("audio/*") || > ctype.equals("video/*")) > > Best regards, > Pavel > > -- > To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> > For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org> > > -- To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>