[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libextractor] libextractor, java, windows
From: |
Steve Whitlatch |
Subject: |
Re: [libextractor] libextractor, java, windows |
Date: |
Sat, 21 Apr 2007 14:13:08 -0700 |
User-agent: |
KMail/1.9.3 |
Hello Nils Durner,
Thanks for your response. Sorry for my delayed response to your response. Here
it is now.
> [ . . .] Just put everything (*.exe and *.dll) in a bin/ directory.
I tried with all *.exe and *.dll in a c:\temp\ . . .\ . . .\bin.
No success yet on Windows 2000 server. Does it work for you? Which windows? No
big deal, if it can work on Windows I will eventually get it to work there
too.
I'm really more interested in using the java bindings in a web app on Linux. I
ran "javadoc" on the libextractor *.java files to get some docs and also
looked at the libextractor(3) man page.
I need to do something like pass a byte[] to the
EXTRACTOR_KeywordList * kl = EXTRACTOR_getKeywords(ex, filename);
function, but I see that is not possible. In my web app, I must have the mime
types prior to writing the files to disk. In fact, that's the reason for
getting the mime types in the first place. The byte arrays are coming from
compressed uploads in streams. Each stream is transformed first to a file in
the form of a byte[], and then into many byte arrays (the files from the
compressed archive). If a mime type is not one of the correct, approved mime
types, then the byte[] does not get written to disk as a file.
I read some prior posts discussing the "get mime type" issue and found this:
************
#include <extractor.h>
char * getMime(const char * filename) {
EXTRACTOR_ExtractorList * ex = EXTRACTOR_loadDefaultLibraries();
EXTRACTOR_KeywordList * kl = EXTRACTOR_getKeywords(ex, filename);
char * mimetype = strdup(EXTRACTOR_extractLast(EXTRACTOR_MIMETYPE, kl);
EXTRACTOR_freeKeywords(kl);
EXTRACTOR_removeAll(ex);
return mimetype;
}
************
Bingo! Except for the type of the argument passed to
EXTRACTOR_getKeywords(ex, filename);
How difficult would it be to include an overloaded function, something like
EXTRACTOR_getKeywords(ex, byteArray);
I can probably make my own JNI class files to call the libextractor C library,
or maybe the present java binding will help in some way. I don't know yet. It
is the passing in of the byte[] problem that must be solved first. Is this
idea something libextractor developers can easily do? If so, can you show me
how I might do that too?
Perhaps this is a reasonable request for an enhancement to the libextractor
library? Or, should I try to do it myself? After I saw the above code
snippet, I started to remember a bit of C code. Any tips?
I think that if libextractor is already a good, fast solution to the "get mime
type" issue, maybe others could also benefit from something like
EXTRACTOR_getKeywords(ex, byteArray);
Thanks for your help.
Steve Whitlatch
On Tuesday 10 April 2007 10:30, you wrote:
> Hi,
>
> > The libextractor-0.5.14.zip package is a binary package, but is it a
> > cygwin
> > binary package?
>
> No, it was built using MinGW (mingw.org).
>
> > Meaning, does it require cygwin?
>
> No.
>
> > So it
> > expects not to be installed in /usr or /usr/local, correct?
>
>
> > If not requiring
> > cygwin, then I suppose that extract.exe should work from a DOS command
> > line,
> > but it does not and gives the error: "The application failed to
> > initialize properly . . .".
>
> That's odd, maybe this is due to missing DLLs - just unzipping the ZIP
> does not work, see above.
>
> > I tried to compile libextrator from source in cygwin myself but no joy.
>
> Building using MinGW should work, see
> http://www.gnunet.org/hacking_win32_build.php3
>
> > Except, I need something like a set of javadocs so that I know what
> > methods
> > are available and the method signatures that I can call. How do I get
> > that?
> > [...]
> > Send a file as a byte array and get back the mime-type as a String.
> > Can I do
> > that with libextractor via Java?
>
> There is a Java binding for LE (https://gnunet.org/svn/Extractor-java),
> but I have never seen it in action.
>
> > I need something like javadocs. How do C programmers know what function
> > signatures are available in a library?
>
> This is an improved "javadoc" that is also able to handle C source:
> http://www.stack.nl/~dimitri/doxygen/index.html
>
> Libextractor's main header file is here:
> https://gnunet.org/svn/Extractor/src/include/extractor.h
>
>
> Hope this helps,
>
>
> Nils Durner
- [libextractor] libextractor, java, windows, Steve Whitlatch, 2007/04/09
- Re: [libextractor] libextractor, java, windows, Nils Durner, 2007/04/10
- Re: [libextractor] libextractor, java, windows,
Steve Whitlatch <=
- Re: [libextractor] libextractor, java, windows, Christian Grothoff, 2007/04/21
- Re: [libextractor] libextractor, java, windows, Christian Grothoff, 2007/04/21
- Re: [libextractor] libextractor, java, windows, Nils Durner, 2007/04/22