Hi Dan,
dont think JAF solves these kind of problems all at once out of the box.
JAF is no silver bullet.
It only provides an extensible api for these kinds of problems.
If you want it to detect a fileformat you or Sun or anybody else has to provide the code for it. It is long ago since I looked into this api but I am sure that you can extend the detection capabilities yourself.

Read http://java.sun.com/products/javabeans/glasgow/JAF-1.0.pdf for further information and look at the samples coming with JAF.

This is out of JAF-1.0.pdf:

There is a one-to-one correspondence between underlying data items (files for instance) and DataSource objects. Also note that the class that implements the DataSource interface is responsible for typing the data. To manage a file system, a DataSource can use a simple mechanism such as a file extension to type data, while a DataSource that supports incoming web-based data can actually examine the data stream to determine its
type.

public interface DataSource {
/**
* This method returns the MIME Type of the data in the form
* of a string. It should always return a valid type. It is
* suggested that getContentType return
* “application/octet-stream” if the DataSource implementation
* can not determine the data type.
*
* @return the MIME Type
*/
public String getContentType();

..


If you dont understand how to extends this for your purposes perhaps you find a open source email client software that uses JAF. I am not sure about this but it is where I would start searching.
Best regards,
Carsten



Dan McKeon wrote:

This is great for ASCII, but do you know how to get more information from an "application/octet-stream" result?




Carsten Hammer <[EMAIL PROTECTED]>

10/27/2005 04:02 PM

        
To
        Dan McKeon <[EMAIL PROTECTED]>
cc
        iText Mail Group <[email protected]>
Subject
        Re: Image Type Detection


        





Hi Dan,
if you want to keep with standard apis then you should try to use

String mimetype=new FileDataSource(filename).getContentType();

See the examples coming with  JavaBeans(TM) Activation Framework for how
to use it.
Best regards,
Carsten

Dan McKeon wrote:
 >
 > Our extensions reflect the business process rather than the file type.
 >  For example, everything we scan is TIFF, but they may have a IIX, SCN,
 > PSM, etc extension.  We have database codes associated with the files
 > that I can use to tell me what format it is, but I was looking for
 > something more generic, whether the file is registered with our system
> or not. >
 >
 >
 >
 > "Bill Ensley" <[EMAIL PROTECTED]>
 >
 > 10/25/2005 03:02 PM
 >
> > To > "'Dan McKeon'" <[EMAIL PROTECTED]>, "iText Mail Group"
 > <[email protected]>
 > cc
> > Subject
 >                  RE: [iText-questions] Image Type Detection
 >
 >
> >
 >
 >
 >
 >
 > Just check the extension.
> > .txt
 > .doc
 > .pdf
 > .jpg
> > etc > > Bill Ensley
 > Bear Printing
 >
 > ------------------------------------------------------------------------
 > From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Dan McKeon
 > Sent: Tuesday, October 25, 2005 12:32 PM
 > To: Bruno Lowagie
 > Cc: [email protected]
 > Subject: Re: [iText-questions] Image Type Detection
 >
 >
 > I just wasn't sure if iText could tell me if my input file is ASCII or
 > PCL.  I figured out how to detect PDF.  I invoke PdfReader and if it
 > throws an exception, I know it's not PDF.  Is there anything like that
 > for ASCII or PCL?
 >
 >
 >
 > Bruno Lowagie <[EMAIL PROTECTED]>
 >
 > 10/25/2005 01:26 PM
 >
> > To
 >                  Dan McKeon <[EMAIL PROTECTED]>
 > cc
 >                  [email protected]
 > Subject
 >                  Re: [iText-questions] Image Type Detection
 >
 >
 >
> >
 >
 >
 >
 >
 >
 > Dan McKeon wrote:
 >
 >  >
 >  > I am a programmer on an Image Team.  The documents in our system are
 >  > TIFF, JPEG, ASCII, PCL, PDF.  I wanted to code a web service that
 >  > could detect what was being input and just always output a PDF.
 >
 > That I can understand. You want to write some software that can detect
 > the format of a file.
 > What I didn't understand is why you would want to stuff that in the
 > Image class.
 > I'm still not sure if your mail contains a question or an intention.
 > br,
 > Bruno
 >
 >
 >
 >
 > ****
 > This message may contain confidential information intended only for the
 > use of the
 > addressee(s) named above and may contain information that is legally
> privileged. > If you are not the addressee, or the person responsible for delivering
 > it to the
 > addressee, you are hereby notified that reading, disseminating,
 > distributing or
 > copying this message is strictly prohibited.  If you have received this
 > message
 > by mistake, please immediately notify us by replying to the message and
 > delete
 > the original message immediately thereafter.  Thank you.
 > ****
 >
 >
 >
 >
 >
 >
 > ****
> This message may contain confidential information intended only for the use of the > addressee(s) named above and may contain information that is legally privileged. > If you are not the addressee, or the person responsible for delivering it to the > addressee, you are hereby notified that reading, disseminating, distributing or > copying this message is strictly prohibited. If you have received this message > by mistake, please immediately notify us by replying to the message and delete
 > the original message immediately thereafter.  Thank you.
 > ****
 >





****
This message may contain confidential information intended only for the use of the addressee(s) named above and may contain information that is legally privileged. If you are not the addressee, or the person responsible for delivering it to the addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message immediately thereafter. Thank you.
****



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to