[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libextractor-java] 11/20: updating code to work with libex
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libextractor-java] 11/20: updating code to work with libextractor 0.6 |
Date: |
Sat, 13 Apr 2019 13:46:06 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository libextractor-java.
commit 60a38f04f14a7c32816aea8017c88c9f0ca58743
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Jan 1 00:29:25 2010 +0000
updating code to work with libextractor 0.6
---
org/gnu/libextractor/MetaData.java | 148 +++++++++++++++++++++++++++++++++++++
1 file changed, 148 insertions(+)
diff --git a/org/gnu/libextractor/MetaData.java
b/org/gnu/libextractor/MetaData.java
new file mode 100644
index 0000000..6d79516
--- /dev/null
+++ b/org/gnu/libextractor/MetaData.java
@@ -0,0 +1,148 @@
+/*
+ This file is part of libextractor.
+ (C) 2002, 2003, 2004, 2007, 2010 Vidyut Samanta and Christian Grothoff
+
+ libextractor is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ libextractor is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libextractor; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+package org.gnu.libextractor;
+
+import java.util.ArrayList;
+import java.io.File;
+import java.io.FileInputStream;
+
+/**
+ * An item of meta data extracted by GNU libextractor.
+ *
+ * @see Extractor
+ * @author Christian Grothoff
+ */
+public final class MetaData {
+
+ /**
+ * Format is unknown.
+ */
+ public static final int METAFORMAT_UNKNOWN = 0;
+
+ /**
+ * 0-terminated, UTF-8 encoded string. "data_len"
+ * is strlen(data)+1.
+ */
+ public static final int METAFORMAT_UTF8 = 1;
+
+ /**
+ * Some kind of binary format, see given Mime type.
+ */
+ public static final int METAFORMAT_BINARY = 2;
+
+ /**
+ * 0-terminated string. The specific encoding is unknown.
+ * "data_len" is strlen(data)+1.
+ */
+ public static final int METAFORMAT_C_STRING = 3;
+
+
+ /**
+ * Cached list of Strings describing keyword types.
+ */
+ private final static String[] typeCache_;
+
+ static {
+ typeCache_ = new String[Extractor.getMaxTypeInternal()];
+ }
+
+ /**
+ * LE type number for this meta data item.
+ */
+ public final int type;
+
+ /**
+ * LE format given for the meta data.
+ */
+ public final int format;
+
+ /**
+ * The meta data itself.
+ */
+ public final byte[] meta;
+
+ /**
+ * Mime-type of the meta data.
+ */
+ public final String meta_mime;
+
+
+ /**
+ * Constructor is only called from "native" code.
+ *
+ * @param t type of the meta data
+ * @param f format of the meta data
+ * @param m the actual meta data
+ * @param mm mime type of the meta data
+ */
+ private MetaData (int t,
+ int f,
+ byte[] m,
+ String mm) {
+ this.type = t;
+ this.format = f;
+ this.meta = m;
+ this.meta_mime = mm;
+ }
+
+
+ public String toString() {
+ return getTypeAsString() + " - " + getMetaDataAsString ();
+ }
+
+
+ /**
+ * Return the meta data as a "String" (if the format
+ * type permits this).
+ *
+ * @return null if the format of the meta data is unknown
+ */
+ public String getMetaDataAsString () {
+ switch (format) {
+ case METAFORMAT_C_STRING:
+ return new String (meta);
+ case METAFORMAT_UTF8:
+ try {
+ return new String (meta, "UTF-8");
+ } catch (java.io.UnsupportedEncodingException uee) {
+ // Java should ALWAYS support UTF-8
+ throw new Error (uee);
+ }
+ case METAFORMAT_BINARY:
+ return "(binary, " + meta.length + " bytes)";
+ default:
+ return null;
+ }
+
+ }
+
+
+ /**
+ * @return description of this meta data item as a string
+ */
+ public String getTypeAsString() {
+ if (typeCache_[type] == null)
+ typeCache_[type]
+ = Extractor.getTypeAsStringInternal(type);
+ return typeCache_[type];
+ }
+
+
+} // end of MetaData
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [libextractor-java] 04/20: release 0.5.1, (continued)
- [GNUnet-SVN] [libextractor-java] 04/20: release 0.5.1, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 07/20: libextractor JNI From: Andrew Marrington <address@hidden> To: address@hidden Date: Today 02:51:57 am, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 06/20: fix, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 03/20: java, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 08/20: Dear Christian,, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 12/20: ignores, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 15/20: -verion bump, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 17/20: -bringing copyright tags up to FSF standard, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 20/20: change cvsignore to gitignore, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 18/20: -bringing copyright tags up to FSF standard, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 11/20: updating code to work with libextractor 0.6,
gnunet <=
- [GNUnet-SVN] [libextractor-java] 16/20: -chlg, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 19/20: fix #3869: outdated FSF address, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 09/20: API update, releasing 0.5.18, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 05/20: jni.h is hard to find, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 10/20: updating code to work with libextractor 0.6, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 02/20: update, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 13/20: release, gnunet, 2019/04/13
- [GNUnet-SVN] [libextractor-java] 14/20: gplv3, gnunet, 2019/04/13