You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2016/06/29 11:11:37 UTC

[31/39] tika git commit: Convert new lines from windows to unix

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/mp3/Mp3Parser.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/mp3/Mp3Parser.java b/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/mp3/Mp3Parser.java
index 53bf241..3b79f31 100644
--- a/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/mp3/Mp3Parser.java
+++ b/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/mp3/Mp3Parser.java
@@ -1,246 +1,246 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.mp3;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.io.TailStream;
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.metadata.TikaCoreProperties;
-import org.apache.tika.metadata.XMPDM;
-import org.apache.tika.mime.MediaType;
-import org.apache.tika.parser.AbstractParser;
-import org.apache.tika.parser.ParseContext;
-import org.apache.tika.parser.mp3.ID3Tags.ID3Comment;
-import org.apache.tika.sax.XHTMLContentHandler;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
-/**
- * The <code>Mp3Parser</code> is used to parse ID3 Version 1 Tag information
- * from an MP3 file, if available.
- *
- * @see <a href="http://www.id3.org/ID3v1">MP3 ID3 Version 1 specification</a>
- * @see <a href="http://www.id3.org/id3v2.4.0-structure">MP3 ID3 Version 2.4 Structure Specification</a>
- * @see <a href="http://www.id3.org/id3v2.4.0-frames">MP3 ID3 Version 2.4 Frames Specification</a>
- */
-public class Mp3Parser extends AbstractParser {
-
-    /** Serial version UID */
-    private static final long serialVersionUID = 8537074922934844370L;
-
-    private static final Set<MediaType> SUPPORTED_TYPES =
-        Collections.singleton(MediaType.audio("mpeg"));
-
-    public Set<MediaType> getSupportedTypes(ParseContext context) {
-        return SUPPORTED_TYPES;
-    }
-
-
-    public void parse(
-            InputStream stream, ContentHandler handler,
-            Metadata metadata, ParseContext context)
-            throws IOException, SAXException, TikaException {
-        metadata.set(Metadata.CONTENT_TYPE, "audio/mpeg");
-        metadata.set(XMPDM.AUDIO_COMPRESSOR, "MP3");
-
-        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
-        xhtml.startDocument();
-
-        // Create handlers for the various kinds of ID3 tags
-        ID3TagsAndAudio audioAndTags = getAllTagHandlers(stream, handler);
-
-        // Process tags metadata if the file has supported tags
-        if (audioAndTags.tags.length > 0) {
-           CompositeTagHandler tag = new CompositeTagHandler(audioAndTags.tags);
-
-           metadata.set(TikaCoreProperties.TITLE, tag.getTitle());
-           metadata.set(TikaCoreProperties.CREATOR, tag.getArtist());
-           metadata.set(XMPDM.ARTIST, tag.getArtist());
-           metadata.set(XMPDM.ALBUM_ARTIST, tag.getAlbumArtist());
-           metadata.set(XMPDM.COMPOSER, tag.getComposer());
-           metadata.set(XMPDM.ALBUM, tag.getAlbum());
-           metadata.set(XMPDM.COMPILATION, tag.getCompilation());
-           metadata.set(XMPDM.RELEASE_DATE, tag.getYear());
-           metadata.set(XMPDM.GENRE, tag.getGenre());
-
-           List<String> comments = new ArrayList<String>();
-           for (ID3Comment comment : tag.getComments()) {
-              StringBuffer cmt = new StringBuffer();
-              if (comment.getLanguage() != null) {
-                 cmt.append(comment.getLanguage());
-                 cmt.append(" - ");
-              }
-              if (comment.getDescription() != null) {
-                 cmt.append(comment.getDescription());
-                 if (comment.getText() != null) {
-                    cmt.append("\n");
-                 }
-              }
-              if (comment.getText() != null) {
-                 cmt.append(comment.getText());
-              }
-              
-              comments.add(cmt.toString());
-              metadata.add(XMPDM.LOG_COMMENT.getName(), cmt.toString());
-           }
-
-           xhtml.element("h1", tag.getTitle());
-           xhtml.element("p", tag.getArtist());
-
-            // ID3v1.1 Track addition
-            StringBuilder sb = new StringBuilder();
-            sb.append(tag.getAlbum());
-            if (tag.getTrackNumber() != null) {
-                sb.append(", track ").append(tag.getTrackNumber());
-                metadata.set(XMPDM.TRACK_NUMBER, tag.getTrackNumber());
-            }
-            if (tag.getDisc() != null) {
-                sb.append(", disc ").append(tag.getDisc());
-                metadata.set(XMPDM.DISC_NUMBER, tag.getDisc());
-            }
-            xhtml.element("p", sb.toString());
-            
-            xhtml.element("p", tag.getYear());
-            xhtml.element("p", tag.getGenre());
-            xhtml.element("p", String.valueOf(audioAndTags.duration));
-            for (String comment : comments) {
-               xhtml.element("p", comment);
-            }
-        }
-        if (audioAndTags.duration > 0) {
-            metadata.set(XMPDM.DURATION, audioAndTags.duration);
-        }
-        if (audioAndTags.audio != null) {
-            metadata.set("samplerate", String.valueOf(audioAndTags.audio.getSampleRate()));
-            metadata.set("channels", String.valueOf(audioAndTags.audio.getChannels()));
-            metadata.set("version", audioAndTags.audio.getVersion());
-            
-            metadata.set(
-                    XMPDM.AUDIO_SAMPLE_RATE,
-                    Integer.toString(audioAndTags.audio.getSampleRate()));
-            if(audioAndTags.audio.getChannels() == 1) {
-               metadata.set(XMPDM.AUDIO_CHANNEL_TYPE, "Mono");
-            } else if(audioAndTags.audio.getChannels() == 2) {
-               metadata.set(XMPDM.AUDIO_CHANNEL_TYPE, "Stereo");
-            } else if(audioAndTags.audio.getChannels() == 5) {
-               metadata.set(XMPDM.AUDIO_CHANNEL_TYPE, "5.1");
-            } else if(audioAndTags.audio.getChannels() == 7) {
-               metadata.set(XMPDM.AUDIO_CHANNEL_TYPE, "7.1");
-            }
-        }
-        if (audioAndTags.lyrics != null && audioAndTags.lyrics.hasLyrics()) {
-           xhtml.startElement("p", "class", "lyrics");
-           xhtml.characters(audioAndTags.lyrics.lyricsText);
-           xhtml.endElement("p");
-        }
-
-        xhtml.endDocument();
-    }
-
-    /**
-     * Scans the MP3 frames for ID3 tags, and creates ID3Tag Handlers
-     *  for each supported set of tags. 
-     */
-    protected static ID3TagsAndAudio getAllTagHandlers(InputStream stream, ContentHandler handler)
-           throws IOException, SAXException, TikaException {
-       ID3v24Handler v24 = null;
-       ID3v23Handler v23 = null;
-       ID3v22Handler v22 = null;
-       ID3v1Handler v1 = null;
-       LyricsHandler lyrics = null;
-       AudioFrame firstAudio = null;
-
-       TailStream tailStream = new TailStream(stream, 10240+128);
-       MpegStream mpegStream = new MpegStream(tailStream);
-
-       // ID3v2 tags live at the start of the file
-       // You can apparently have several different ID3 tag blocks
-       // So, keep going until we don't find any more
-       MP3Frame f;
-       while ((f = ID3v2Frame.createFrameIfPresent(mpegStream)) != null) {
-           if(f instanceof ID3v2Frame) {
-               ID3v2Frame id3F = (ID3v2Frame)f;
-               if (id3F.getMajorVersion() == 4) {
-                   v24 = new ID3v24Handler(id3F);
-               } else if(id3F.getMajorVersion() == 3) {
-                   v23 = new ID3v23Handler(id3F);
-               } else if(id3F.getMajorVersion() == 2) {
-                   v22 = new ID3v22Handler(id3F);
-               }
-           }
-       }
-
-        // Now iterate over all audio frames in the file
-        AudioFrame frame = mpegStream.nextFrame();
-        float duration = 0;
-        while (frame != null)
-        {
-            duration += frame.getDuration();
-            if (firstAudio == null)
-            {
-                firstAudio = frame;
-            }
-            mpegStream.skipFrame();
-            frame = mpegStream.nextFrame();
-        }
-
-       // ID3v1 tags live at the end of the file
-       // Lyrics live just before ID3v1, at the end of the file
-       // Search for both (handlers seek to the end for us)
-       lyrics = new LyricsHandler(tailStream.getTail());
-       v1 = lyrics.id3v1;
-
-       // Go in order of preference
-       // Currently, that's newest to oldest
-       List<ID3Tags> tags = new ArrayList<ID3Tags>();
-
-       if(v24 != null && v24.getTagsPresent()) {
-          tags.add(v24);
-       }
-       if(v23 != null && v23.getTagsPresent()) {
-          tags.add(v23);
-       }
-       if(v22 != null && v22.getTagsPresent()) {
-          tags.add(v22);
-       }
-       if(v1 != null && v1.getTagsPresent()) {
-          tags.add(v1);
-       }
-       
-       ID3TagsAndAudio ret = new ID3TagsAndAudio();
-       ret.audio = firstAudio;
-       ret.lyrics = lyrics;
-       ret.tags = tags.toArray(new ID3Tags[tags.size()]);
-       ret.duration = duration;
-       return ret;
-    }
-
-    protected static class ID3TagsAndAudio {
-        private ID3Tags[] tags;
-        private AudioFrame audio;
-        private LyricsHandler lyrics;
-        private float duration;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.mp3;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.io.TailStream;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.metadata.TikaCoreProperties;
+import org.apache.tika.metadata.XMPDM;
+import org.apache.tika.mime.MediaType;
+import org.apache.tika.parser.AbstractParser;
+import org.apache.tika.parser.ParseContext;
+import org.apache.tika.parser.mp3.ID3Tags.ID3Comment;
+import org.apache.tika.sax.XHTMLContentHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+/**
+ * The <code>Mp3Parser</code> is used to parse ID3 Version 1 Tag information
+ * from an MP3 file, if available.
+ *
+ * @see <a href="http://www.id3.org/ID3v1">MP3 ID3 Version 1 specification</a>
+ * @see <a href="http://www.id3.org/id3v2.4.0-structure">MP3 ID3 Version 2.4 Structure Specification</a>
+ * @see <a href="http://www.id3.org/id3v2.4.0-frames">MP3 ID3 Version 2.4 Frames Specification</a>
+ */
+public class Mp3Parser extends AbstractParser {
+
+    /** Serial version UID */
+    private static final long serialVersionUID = 8537074922934844370L;
+
+    private static final Set<MediaType> SUPPORTED_TYPES =
+        Collections.singleton(MediaType.audio("mpeg"));
+
+    public Set<MediaType> getSupportedTypes(ParseContext context) {
+        return SUPPORTED_TYPES;
+    }
+
+
+    public void parse(
+            InputStream stream, ContentHandler handler,
+            Metadata metadata, ParseContext context)
+            throws IOException, SAXException, TikaException {
+        metadata.set(Metadata.CONTENT_TYPE, "audio/mpeg");
+        metadata.set(XMPDM.AUDIO_COMPRESSOR, "MP3");
+
+        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
+        xhtml.startDocument();
+
+        // Create handlers for the various kinds of ID3 tags
+        ID3TagsAndAudio audioAndTags = getAllTagHandlers(stream, handler);
+
+        // Process tags metadata if the file has supported tags
+        if (audioAndTags.tags.length > 0) {
+           CompositeTagHandler tag = new CompositeTagHandler(audioAndTags.tags);
+
+           metadata.set(TikaCoreProperties.TITLE, tag.getTitle());
+           metadata.set(TikaCoreProperties.CREATOR, tag.getArtist());
+           metadata.set(XMPDM.ARTIST, tag.getArtist());
+           metadata.set(XMPDM.ALBUM_ARTIST, tag.getAlbumArtist());
+           metadata.set(XMPDM.COMPOSER, tag.getComposer());
+           metadata.set(XMPDM.ALBUM, tag.getAlbum());
+           metadata.set(XMPDM.COMPILATION, tag.getCompilation());
+           metadata.set(XMPDM.RELEASE_DATE, tag.getYear());
+           metadata.set(XMPDM.GENRE, tag.getGenre());
+
+           List<String> comments = new ArrayList<String>();
+           for (ID3Comment comment : tag.getComments()) {
+              StringBuffer cmt = new StringBuffer();
+              if (comment.getLanguage() != null) {
+                 cmt.append(comment.getLanguage());
+                 cmt.append(" - ");
+              }
+              if (comment.getDescription() != null) {
+                 cmt.append(comment.getDescription());
+                 if (comment.getText() != null) {
+                    cmt.append("\n");
+                 }
+              }
+              if (comment.getText() != null) {
+                 cmt.append(comment.getText());
+              }
+              
+              comments.add(cmt.toString());
+              metadata.add(XMPDM.LOG_COMMENT.getName(), cmt.toString());
+           }
+
+           xhtml.element("h1", tag.getTitle());
+           xhtml.element("p", tag.getArtist());
+
+            // ID3v1.1 Track addition
+            StringBuilder sb = new StringBuilder();
+            sb.append(tag.getAlbum());
+            if (tag.getTrackNumber() != null) {
+                sb.append(", track ").append(tag.getTrackNumber());
+                metadata.set(XMPDM.TRACK_NUMBER, tag.getTrackNumber());
+            }
+            if (tag.getDisc() != null) {
+                sb.append(", disc ").append(tag.getDisc());
+                metadata.set(XMPDM.DISC_NUMBER, tag.getDisc());
+            }
+            xhtml.element("p", sb.toString());
+            
+            xhtml.element("p", tag.getYear());
+            xhtml.element("p", tag.getGenre());
+            xhtml.element("p", String.valueOf(audioAndTags.duration));
+            for (String comment : comments) {
+               xhtml.element("p", comment);
+            }
+        }
+        if (audioAndTags.duration > 0) {
+            metadata.set(XMPDM.DURATION, audioAndTags.duration);
+        }
+        if (audioAndTags.audio != null) {
+            metadata.set("samplerate", String.valueOf(audioAndTags.audio.getSampleRate()));
+            metadata.set("channels", String.valueOf(audioAndTags.audio.getChannels()));
+            metadata.set("version", audioAndTags.audio.getVersion());
+            
+            metadata.set(
+                    XMPDM.AUDIO_SAMPLE_RATE,
+                    Integer.toString(audioAndTags.audio.getSampleRate()));
+            if(audioAndTags.audio.getChannels() == 1) {
+               metadata.set(XMPDM.AUDIO_CHANNEL_TYPE, "Mono");
+            } else if(audioAndTags.audio.getChannels() == 2) {
+               metadata.set(XMPDM.AUDIO_CHANNEL_TYPE, "Stereo");
+            } else if(audioAndTags.audio.getChannels() == 5) {
+               metadata.set(XMPDM.AUDIO_CHANNEL_TYPE, "5.1");
+            } else if(audioAndTags.audio.getChannels() == 7) {
+               metadata.set(XMPDM.AUDIO_CHANNEL_TYPE, "7.1");
+            }
+        }
+        if (audioAndTags.lyrics != null && audioAndTags.lyrics.hasLyrics()) {
+           xhtml.startElement("p", "class", "lyrics");
+           xhtml.characters(audioAndTags.lyrics.lyricsText);
+           xhtml.endElement("p");
+        }
+
+        xhtml.endDocument();
+    }
+
+    /**
+     * Scans the MP3 frames for ID3 tags, and creates ID3Tag Handlers
+     *  for each supported set of tags. 
+     */
+    protected static ID3TagsAndAudio getAllTagHandlers(InputStream stream, ContentHandler handler)
+           throws IOException, SAXException, TikaException {
+       ID3v24Handler v24 = null;
+       ID3v23Handler v23 = null;
+       ID3v22Handler v22 = null;
+       ID3v1Handler v1 = null;
+       LyricsHandler lyrics = null;
+       AudioFrame firstAudio = null;
+
+       TailStream tailStream = new TailStream(stream, 10240+128);
+       MpegStream mpegStream = new MpegStream(tailStream);
+
+       // ID3v2 tags live at the start of the file
+       // You can apparently have several different ID3 tag blocks
+       // So, keep going until we don't find any more
+       MP3Frame f;
+       while ((f = ID3v2Frame.createFrameIfPresent(mpegStream)) != null) {
+           if(f instanceof ID3v2Frame) {
+               ID3v2Frame id3F = (ID3v2Frame)f;
+               if (id3F.getMajorVersion() == 4) {
+                   v24 = new ID3v24Handler(id3F);
+               } else if(id3F.getMajorVersion() == 3) {
+                   v23 = new ID3v23Handler(id3F);
+               } else if(id3F.getMajorVersion() == 2) {
+                   v22 = new ID3v22Handler(id3F);
+               }
+           }
+       }
+
+        // Now iterate over all audio frames in the file
+        AudioFrame frame = mpegStream.nextFrame();
+        float duration = 0;
+        while (frame != null)
+        {
+            duration += frame.getDuration();
+            if (firstAudio == null)
+            {
+                firstAudio = frame;
+            }
+            mpegStream.skipFrame();
+            frame = mpegStream.nextFrame();
+        }
+
+       // ID3v1 tags live at the end of the file
+       // Lyrics live just before ID3v1, at the end of the file
+       // Search for both (handlers seek to the end for us)
+       lyrics = new LyricsHandler(tailStream.getTail());
+       v1 = lyrics.id3v1;
+
+       // Go in order of preference
+       // Currently, that's newest to oldest
+       List<ID3Tags> tags = new ArrayList<ID3Tags>();
+
+       if(v24 != null && v24.getTagsPresent()) {
+          tags.add(v24);
+       }
+       if(v23 != null && v23.getTagsPresent()) {
+          tags.add(v23);
+       }
+       if(v22 != null && v22.getTagsPresent()) {
+          tags.add(v22);
+       }
+       if(v1 != null && v1.getTagsPresent()) {
+          tags.add(v1);
+       }
+       
+       ID3TagsAndAudio ret = new ID3TagsAndAudio();
+       ret.audio = firstAudio;
+       ret.lyrics = lyrics;
+       ret.tags = tags.toArray(new ID3Tags[tags.size()]);
+       ret.duration = duration;
+       return ret;
+    }
+
+    protected static class ID3TagsAndAudio {
+        private ID3Tags[] tags;
+        private AudioFrame audio;
+        private LyricsHandler lyrics;
+        private float duration;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/video/FLVParser.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/video/FLVParser.java b/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/video/FLVParser.java
index 1a0b1b9..947b694 100644
--- a/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/video/FLVParser.java
+++ b/tika-parser-modules/tika-parser-multimedia-module/src/main/java/org/apache/tika/parser/video/FLVParser.java
@@ -1,268 +1,268 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.video;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.mime.MediaType;
-import org.apache.tika.parser.AbstractParser;
-import org.apache.tika.parser.ParseContext;
-import org.apache.tika.sax.XHTMLContentHandler;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * <p>
- * Parser for metadata contained in Flash Videos (.flv). Resources:
- * http://osflash.org/flv and for AMF:
- * http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf
- * <p>
- * This parser is capable of extracting the general metadata from header as well
- * as embedded metadata.
- * <p>
- * Known keys for metadata (from file header):
- * <ol>
- * <li>hasVideo: true|false
- * <li>hasSound: true|false
- * </ol>
- * <p>
- * In addition to the above values also metadata that is inserted in to the
- * actual stream will be picked. Usually there are keys like:
- * hasKeyframes, lastkeyframetimestamp, audiocodecid, keyframes, filepositions,
- * hasMetadata, audiosamplerate, videodatarate metadatadate, videocodecid,
- * metadatacreator, audiosize, hasVideo, height, audiosamplesize, framerate,
- * hasCuePoints width, cuePoints, lasttimestamp, canSeekToEnd, datasize,
- * duration, videosize, filesize, audiodatarate, hasAudio, stereo audiodelay
- */
-public class FLVParser extends AbstractParser {
-
-    /** Serial version UID */
-    private static final long serialVersionUID = -8718013155719197679L;
-
-    private static int TYPE_METADATA = 0x12;
-    private static byte MASK_AUDIO = 1;
-    private static byte MASK_VIDEO = 4;
-
-    private static final Set<MediaType> SUPPORTED_TYPES =
-        Collections.singleton(MediaType.video("x-flv"));
-
-    public Set<MediaType> getSupportedTypes(ParseContext context) {
-        return SUPPORTED_TYPES;
-    }
-
-    private long readUInt32(DataInputStream input) throws IOException {
-        return input.readInt() & 0xFFFFFFFFL;
-    }
-
-    private int readUInt24(DataInputStream input) throws IOException {
-        int uint = input.read()<<16;
-        uint += input.read()<<8;
-        uint += input.read(); 
-        return uint;
-    }
-
-    private Object readAMFData(DataInputStream input, int type)
-            throws IOException {
-        if (type == -1) {
-            type = input.readUnsignedByte();
-        }
-        switch (type) {
-        case 0:
-            return input.readDouble();
-        case 1:
-            return input.readUnsignedByte() == 1;
-        case 2:
-            return readAMFString(input);
-        case 3:
-            return readAMFObject(input);
-        case 8:
-            return readAMFEcmaArray(input);
-        case 10:
-            return readAMFStrictArray(input);
-        case 11:
-            final Date date = new Date((long) input.readDouble());
-            input.readShort(); // time zone
-            return date;
-        case 13:
-            return "UNDEFINED";
-        default:
-            return null;
-        }
-    }
-
-    private Object readAMFStrictArray(DataInputStream input) throws IOException {
-        long count = readUInt32(input);
-        ArrayList<Object> list = new ArrayList<Object>();
-        for (int i = 0; i < count; i++) {
-            list.add(readAMFData(input, -1));
-        }
-        return list;
-    }
-
-
-    private String readAMFString(DataInputStream input) throws IOException {
-        int size = input.readUnsignedShort();
-        byte[] chars = new byte[size];
-        input.readFully(chars);
-        return new String(chars, UTF_8);
-    }
-
-    private Object readAMFObject(DataInputStream input) throws IOException {
-        HashMap<String, Object> array = new HashMap<String, Object>();
-        while (true) {
-            String key = readAMFString(input);
-            int dataType = input.read();
-            if (dataType == 9) { // object end marker
-                break;
-            }
-            array.put(key, readAMFData(input, dataType));
-        }
-        return array;
-    }
-
-    private Object readAMFEcmaArray(DataInputStream input) throws IOException {
-        long size = readUInt32(input);
-        HashMap<String, Object> array = new HashMap<String, Object>();
-        for (int i = 0; i < size; i++) {
-            String key = readAMFString(input);
-            int dataType = input.read();
-            array.put(key, readAMFData(input, dataType));
-        }
-        return array;
-    }
-
-    private boolean checkSignature(DataInputStream fis) throws IOException {
-        return fis.read() == 'F' && fis.read() == 'L' && fis.read() == 'V';
-    }
-
-    public void parse(
-            InputStream stream, ContentHandler handler,
-            Metadata metadata, ParseContext context)
-            throws IOException, SAXException, TikaException {
-        DataInputStream datainput = new DataInputStream(stream);
-        if (!checkSignature(datainput)) {
-            throw new TikaException("FLV signature not detected");
-        }
-
-        // header
-        int version = datainput.readUnsignedByte();
-        if (version != 1) {
-            // should be 1, perhaps this is not flv?
-            throw new TikaException("Unpexpected FLV version: " + version);
-        }
-
-        int typeFlags = datainput.readUnsignedByte();
-
-        long len = readUInt32(datainput);
-        if (len != 9) {
-            // we only know about format with header of 9 bytes
-            throw new TikaException("Unpexpected FLV header length: " + len);
-        }
-
-        long sizePrev = readUInt32(datainput);
-        if (sizePrev != 0) {
-            // should be 0, perhaps this is not flv?
-            throw new TikaException(
-                    "Unpexpected FLV first previous block size: " + sizePrev);
-        }
-
-        metadata.set(Metadata.CONTENT_TYPE, "video/x-flv");
-        metadata.set("hasVideo", Boolean.toString((typeFlags & MASK_VIDEO) != 0));
-        metadata.set("hasAudio", Boolean.toString((typeFlags & MASK_AUDIO) != 0));
-
-        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
-        xhtml.startDocument();
-
-        // flv tag stream follows...
-        while (true) {
-            int type = datainput.read();
-            if (type == -1) {
-                // EOF
-                break;
-            }
-
-            int datalen = readUInt24(datainput); //body length
-            readUInt32(datainput); // timestamp
-            readUInt24(datainput); // streamid
-
-            if (type == TYPE_METADATA) {
-                // found metadata Tag, read content to buffer
-                byte[] metaBytes = new byte[datalen];
-                for (int readCount = 0; readCount < datalen;) {
-                    int r = stream.read(metaBytes, readCount, datalen - readCount);
-                    if(r!=-1) {
-                        readCount += r;
-
-                    } else {
-                        break;
-                    }
-                }
-
-                ByteArrayInputStream is = new ByteArrayInputStream(metaBytes);
-
-                DataInputStream dis = new DataInputStream(is);
-
-                Object data = null;
-
-                for (int i = 0; i < 2; i++) {
-                    data = readAMFData(dis, -1);
-                }
-
-                if (data instanceof Map) {
-                    // TODO if there are multiple metadata values with same key (in
-                    // separate AMF blocks, we currently loose previous values)
-                    Map<String, Object> extractedMetadata = (Map<String, Object>) data;
-                    for (Entry<String, Object> entry : extractedMetadata.entrySet()) {
-                        if (entry.getValue() == null) {
-                            continue;
-                        }
-                        metadata.set(entry.getKey(), entry.getValue().toString());
-                    }
-                }
-
-            } else {
-                // Tag was not metadata, skip over data we cannot handle
-                for (int i = 0; i < datalen; i++) {
-                    datainput.readByte();
-                }
-            }
-
-            sizePrev = readUInt32(datainput); // previous block size
-            if (sizePrev != datalen + 11) {
-                // file was corrupt or we could not parse it...
-                break;
-            }
-        }
-
-        xhtml.endDocument();
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.video;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.mime.MediaType;
+import org.apache.tika.parser.AbstractParser;
+import org.apache.tika.parser.ParseContext;
+import org.apache.tika.sax.XHTMLContentHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+/**
+ * <p>
+ * Parser for metadata contained in Flash Videos (.flv). Resources:
+ * http://osflash.org/flv and for AMF:
+ * http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf
+ * <p>
+ * This parser is capable of extracting the general metadata from header as well
+ * as embedded metadata.
+ * <p>
+ * Known keys for metadata (from file header):
+ * <ol>
+ * <li>hasVideo: true|false
+ * <li>hasSound: true|false
+ * </ol>
+ * <p>
+ * In addition to the above values also metadata that is inserted in to the
+ * actual stream will be picked. Usually there are keys like:
+ * hasKeyframes, lastkeyframetimestamp, audiocodecid, keyframes, filepositions,
+ * hasMetadata, audiosamplerate, videodatarate metadatadate, videocodecid,
+ * metadatacreator, audiosize, hasVideo, height, audiosamplesize, framerate,
+ * hasCuePoints width, cuePoints, lasttimestamp, canSeekToEnd, datasize,
+ * duration, videosize, filesize, audiodatarate, hasAudio, stereo audiodelay
+ */
+public class FLVParser extends AbstractParser {
+
+    /** Serial version UID */
+    private static final long serialVersionUID = -8718013155719197679L;
+
+    private static int TYPE_METADATA = 0x12;
+    private static byte MASK_AUDIO = 1;
+    private static byte MASK_VIDEO = 4;
+
+    private static final Set<MediaType> SUPPORTED_TYPES =
+        Collections.singleton(MediaType.video("x-flv"));
+
+    public Set<MediaType> getSupportedTypes(ParseContext context) {
+        return SUPPORTED_TYPES;
+    }
+
+    private long readUInt32(DataInputStream input) throws IOException {
+        return input.readInt() & 0xFFFFFFFFL;
+    }
+
+    private int readUInt24(DataInputStream input) throws IOException {
+        int uint = input.read()<<16;
+        uint += input.read()<<8;
+        uint += input.read(); 
+        return uint;
+    }
+
+    private Object readAMFData(DataInputStream input, int type)
+            throws IOException {
+        if (type == -1) {
+            type = input.readUnsignedByte();
+        }
+        switch (type) {
+        case 0:
+            return input.readDouble();
+        case 1:
+            return input.readUnsignedByte() == 1;
+        case 2:
+            return readAMFString(input);
+        case 3:
+            return readAMFObject(input);
+        case 8:
+            return readAMFEcmaArray(input);
+        case 10:
+            return readAMFStrictArray(input);
+        case 11:
+            final Date date = new Date((long) input.readDouble());
+            input.readShort(); // time zone
+            return date;
+        case 13:
+            return "UNDEFINED";
+        default:
+            return null;
+        }
+    }
+
+    private Object readAMFStrictArray(DataInputStream input) throws IOException {
+        long count = readUInt32(input);
+        ArrayList<Object> list = new ArrayList<Object>();
+        for (int i = 0; i < count; i++) {
+            list.add(readAMFData(input, -1));
+        }
+        return list;
+    }
+
+
+    private String readAMFString(DataInputStream input) throws IOException {
+        int size = input.readUnsignedShort();
+        byte[] chars = new byte[size];
+        input.readFully(chars);
+        return new String(chars, UTF_8);
+    }
+
+    private Object readAMFObject(DataInputStream input) throws IOException {
+        HashMap<String, Object> array = new HashMap<String, Object>();
+        while (true) {
+            String key = readAMFString(input);
+            int dataType = input.read();
+            if (dataType == 9) { // object end marker
+                break;
+            }
+            array.put(key, readAMFData(input, dataType));
+        }
+        return array;
+    }
+
+    private Object readAMFEcmaArray(DataInputStream input) throws IOException {
+        long size = readUInt32(input);
+        HashMap<String, Object> array = new HashMap<String, Object>();
+        for (int i = 0; i < size; i++) {
+            String key = readAMFString(input);
+            int dataType = input.read();
+            array.put(key, readAMFData(input, dataType));
+        }
+        return array;
+    }
+
+    private boolean checkSignature(DataInputStream fis) throws IOException {
+        return fis.read() == 'F' && fis.read() == 'L' && fis.read() == 'V';
+    }
+
+    public void parse(
+            InputStream stream, ContentHandler handler,
+            Metadata metadata, ParseContext context)
+            throws IOException, SAXException, TikaException {
+        DataInputStream datainput = new DataInputStream(stream);
+        if (!checkSignature(datainput)) {
+            throw new TikaException("FLV signature not detected");
+        }
+
+        // header
+        int version = datainput.readUnsignedByte();
+        if (version != 1) {
+            // should be 1, perhaps this is not flv?
+            throw new TikaException("Unpexpected FLV version: " + version);
+        }
+
+        int typeFlags = datainput.readUnsignedByte();
+
+        long len = readUInt32(datainput);
+        if (len != 9) {
+            // we only know about format with header of 9 bytes
+            throw new TikaException("Unpexpected FLV header length: " + len);
+        }
+
+        long sizePrev = readUInt32(datainput);
+        if (sizePrev != 0) {
+            // should be 0, perhaps this is not flv?
+            throw new TikaException(
+                    "Unpexpected FLV first previous block size: " + sizePrev);
+        }
+
+        metadata.set(Metadata.CONTENT_TYPE, "video/x-flv");
+        metadata.set("hasVideo", Boolean.toString((typeFlags & MASK_VIDEO) != 0));
+        metadata.set("hasAudio", Boolean.toString((typeFlags & MASK_AUDIO) != 0));
+
+        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
+        xhtml.startDocument();
+
+        // flv tag stream follows...
+        while (true) {
+            int type = datainput.read();
+            if (type == -1) {
+                // EOF
+                break;
+            }
+
+            int datalen = readUInt24(datainput); //body length
+            readUInt32(datainput); // timestamp
+            readUInt24(datainput); // streamid
+
+            if (type == TYPE_METADATA) {
+                // found metadata Tag, read content to buffer
+                byte[] metaBytes = new byte[datalen];
+                for (int readCount = 0; readCount < datalen;) {
+                    int r = stream.read(metaBytes, readCount, datalen - readCount);
+                    if(r!=-1) {
+                        readCount += r;
+
+                    } else {
+                        break;
+                    }
+                }
+
+                ByteArrayInputStream is = new ByteArrayInputStream(metaBytes);
+
+                DataInputStream dis = new DataInputStream(is);
+
+                Object data = null;
+
+                for (int i = 0; i < 2; i++) {
+                    data = readAMFData(dis, -1);
+                }
+
+                if (data instanceof Map) {
+                    // TODO if there are multiple metadata values with same key (in
+                    // separate AMF blocks, we currently loose previous values)
+                    Map<String, Object> extractedMetadata = (Map<String, Object>) data;
+                    for (Entry<String, Object> entry : extractedMetadata.entrySet()) {
+                        if (entry.getValue() == null) {
+                            continue;
+                        }
+                        metadata.set(entry.getKey(), entry.getValue().toString());
+                    }
+                }
+
+            } else {
+                // Tag was not metadata, skip over data we cannot handle
+                for (int i = 0; i < datalen; i++) {
+                    datainput.readByte();
+                }
+            }
+
+            sizePrev = readUInt32(datainput); // previous block size
+            if (sizePrev != datalen + 11) {
+                // file was corrupt or we could not parse it...
+                break;
+            }
+        }
+
+        xhtml.endDocument();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-multimedia-module/src/main/resources/org/apache/tika/parser/ocr/TesseractOCRConfig.properties
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-multimedia-module/src/main/resources/org/apache/tika/parser/ocr/TesseractOCRConfig.properties b/tika-parser-modules/tika-parser-multimedia-module/src/main/resources/org/apache/tika/parser/ocr/TesseractOCRConfig.properties
index 904e536..cb2151c 100644
--- a/tika-parser-modules/tika-parser-multimedia-module/src/main/resources/org/apache/tika/parser/ocr/TesseractOCRConfig.properties
+++ b/tika-parser-modules/tika-parser-multimedia-module/src/main/resources/org/apache/tika/parser/ocr/TesseractOCRConfig.properties
@@ -1,21 +1,21 @@
-#  Licensed to the Apache Software Foundation (ASF) under one or more
-#  contributor license agreements.  See the NOTICE file distributed with
-#  this work for additional information regarding copyright ownership.
-#  The ASF licenses this file to You under the Apache License, Version 2.0
-#  (the "License"); you may not use this file except in compliance with
-#  the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-tesseractPath=
-language=eng
-pageSegMode=1
-maxFileSizeToOcr=2147483647
-minFileSizeToOcr=0
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+tesseractPath=
+language=eng
+pageSegMode=1
+maxFileSizeToOcr=2147483647
+minFileSizeToOcr=0
 timeout=120
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/AudioParserTest.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/AudioParserTest.java b/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/AudioParserTest.java
index ae30df3..d35de32 100644
--- a/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/AudioParserTest.java
+++ b/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/AudioParserTest.java
@@ -1,75 +1,75 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.audio;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.tika.Tika;
-import org.apache.tika.metadata.Metadata;
-import org.junit.Test;
-
-public class AudioParserTest {
-
-    @Test
-    public void testWAV() throws Exception {
-        String path = "/test-documents/testWAV.wav";
-        Metadata metadata = new Metadata();
-        String content = new Tika().parseToString(
-                AudioParserTest.class.getResourceAsStream(path), metadata);
-
-        assertEquals("audio/x-wav", metadata.get(Metadata.CONTENT_TYPE));
-        assertEquals("44100.0", metadata.get("samplerate"));
-        assertEquals("2", metadata.get("channels"));
-        assertEquals("16", metadata.get("bits"));
-        assertEquals("PCM_SIGNED", metadata.get("encoding"));
-
-        assertEquals("", content);
-    }
-
-    @Test
-    public void testAIFF() throws Exception {
-        String path = "/test-documents/testAIFF.aif";
-        Metadata metadata = new Metadata();
-        String content = new Tika().parseToString(
-                AudioParserTest.class.getResourceAsStream(path), metadata);
-
-        assertEquals("audio/x-aiff", metadata.get(Metadata.CONTENT_TYPE));
-        assertEquals("44100.0", metadata.get("samplerate"));
-        assertEquals("2", metadata.get("channels"));
-        assertEquals("16", metadata.get("bits"));
-        assertEquals("PCM_SIGNED", metadata.get("encoding"));
-
-        assertEquals("", content);
-    }
-
-    @Test
-    public void testAU() throws Exception {
-        String path = "/test-documents/testAU.au";
-        Metadata metadata = new Metadata();
-        String content = new Tika().parseToString(
-                AudioParserTest.class.getResourceAsStream(path), metadata);
-
-        assertEquals("audio/basic", metadata.get(Metadata.CONTENT_TYPE));
-        assertEquals("44100.0", metadata.get("samplerate"));
-        assertEquals("2", metadata.get("channels"));
-        assertEquals("16", metadata.get("bits"));
-        assertEquals("PCM_SIGNED", metadata.get("encoding"));
-
-        assertEquals("", content);
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.audio;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tika.Tika;
+import org.apache.tika.metadata.Metadata;
+import org.junit.Test;
+
+public class AudioParserTest {
+
+    @Test
+    public void testWAV() throws Exception {
+        String path = "/test-documents/testWAV.wav";
+        Metadata metadata = new Metadata();
+        String content = new Tika().parseToString(
+                AudioParserTest.class.getResourceAsStream(path), metadata);
+
+        assertEquals("audio/x-wav", metadata.get(Metadata.CONTENT_TYPE));
+        assertEquals("44100.0", metadata.get("samplerate"));
+        assertEquals("2", metadata.get("channels"));
+        assertEquals("16", metadata.get("bits"));
+        assertEquals("PCM_SIGNED", metadata.get("encoding"));
+
+        assertEquals("", content);
+    }
+
+    @Test
+    public void testAIFF() throws Exception {
+        String path = "/test-documents/testAIFF.aif";
+        Metadata metadata = new Metadata();
+        String content = new Tika().parseToString(
+                AudioParserTest.class.getResourceAsStream(path), metadata);
+
+        assertEquals("audio/x-aiff", metadata.get(Metadata.CONTENT_TYPE));
+        assertEquals("44100.0", metadata.get("samplerate"));
+        assertEquals("2", metadata.get("channels"));
+        assertEquals("16", metadata.get("bits"));
+        assertEquals("PCM_SIGNED", metadata.get("encoding"));
+
+        assertEquals("", content);
+    }
+
+    @Test
+    public void testAU() throws Exception {
+        String path = "/test-documents/testAU.au";
+        Metadata metadata = new Metadata();
+        String content = new Tika().parseToString(
+                AudioParserTest.class.getResourceAsStream(path), metadata);
+
+        assertEquals("audio/basic", metadata.get(Metadata.CONTENT_TYPE));
+        assertEquals("44100.0", metadata.get("samplerate"));
+        assertEquals("2", metadata.get("channels"));
+        assertEquals("16", metadata.get("bits"));
+        assertEquals("PCM_SIGNED", metadata.get("encoding"));
+
+        assertEquals("", content);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/MidiParserTest.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/MidiParserTest.java b/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/MidiParserTest.java
index 9336444..344f2d7 100644
--- a/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/MidiParserTest.java
+++ b/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/audio/MidiParserTest.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.audio;
-
-import static org.junit.Assert.assertEquals;
-import static org.apache.tika.TikaTest.assertContains;
-
-import org.apache.tika.Tika;
-import org.apache.tika.metadata.Metadata;
-import org.junit.Test;
-
-public class MidiParserTest {
-
-    @Test
-    public void testMID() throws Exception {
-        String path = "/test-documents/testMID.mid";
-        Metadata metadata = new Metadata();
-        String content = new Tika().parseToString(
-                MidiParserTest.class.getResourceAsStream(path), metadata);
-
-        assertEquals("audio/midi", metadata.get(Metadata.CONTENT_TYPE));
-        assertEquals("2", metadata.get("tracks"));
-        assertEquals("0", metadata.get("patches"));
-        assertEquals("PPQ", metadata.get("divisionType"));
-
-        assertContains("Untitled", content);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.audio;
+
+import static org.junit.Assert.assertEquals;
+import static org.apache.tika.TikaTest.assertContains;
+
+import org.apache.tika.Tika;
+import org.apache.tika.metadata.Metadata;
+import org.junit.Test;
+
+public class MidiParserTest {
+
+    @Test
+    public void testMID() throws Exception {
+        String path = "/test-documents/testMID.mid";
+        Metadata metadata = new Metadata();
+        String content = new Tika().parseToString(
+                MidiParserTest.class.getResourceAsStream(path), metadata);
+
+        assertEquals("audio/midi", metadata.get(Metadata.CONTENT_TYPE));
+        assertEquals("2", metadata.get("tracks"));
+        assertEquals("0", metadata.get("patches"));
+        assertEquals("PPQ", metadata.get("divisionType"));
+
+        assertContains("Untitled", content);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/image/ImageMetadataExtractorTest.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/image/ImageMetadataExtractorTest.java b/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/image/ImageMetadataExtractorTest.java
index 51f99db..fdac337 100644
--- a/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/image/ImageMetadataExtractorTest.java
+++ b/tika-parser-modules/tika-parser-multimedia-module/src/test/java/org/apache/tika/parser/image/ImageMetadataExtractorTest.java
@@ -1,139 +1,139 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.image;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Arrays;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.TimeZone;
-
-import com.drew.metadata.Directory;
-import com.drew.metadata.MetadataException;
-import com.drew.metadata.Tag;
-import com.drew.metadata.exif.ExifIFD0Directory;
-import com.drew.metadata.exif.ExifSubIFDDirectory;
-import com.drew.metadata.jpeg.JpegCommentDirectory;
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.metadata.TikaCoreProperties;
-import org.junit.Test;
-
-public class ImageMetadataExtractorTest {
-
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    @Test
-    public void testHandleDirectories() throws MetadataException {
-        Metadata metadata = mock(Metadata.class);
-        ImageMetadataExtractor.DirectoryHandler handler1 = mock(ImageMetadataExtractor.DirectoryHandler.class);
-        ImageMetadataExtractor e = new ImageMetadataExtractor(metadata, handler1);
-
-        Directory directory = new JpegCommentDirectory();
-        Iterator directories = mock(Iterator.class);
-        when(directories.hasNext()).thenReturn(true, false);
-        when(directories.next()).thenReturn(directory);
-        when(handler1.supports(JpegCommentDirectory.class)).thenReturn(true);
-
-        e.handle(directories);
-        verify(handler1).supports(JpegCommentDirectory.class);
-        verify(handler1).handle(directory, metadata);
-    }
-
-    @Test
-    public void testExifHandlerSupports() {
-        assertTrue(new ImageMetadataExtractor.ExifHandler().supports(ExifIFD0Directory.class));
-        assertTrue(new ImageMetadataExtractor.ExifHandler().supports(ExifSubIFDDirectory.class));
-        assertFalse(new ImageMetadataExtractor.ExifHandler().supports(Directory.class));
-        assertFalse(new ImageMetadataExtractor.ExifHandler().supports(JpegCommentDirectory.class));
-    }
-
-    @Test
-    public void testExifHandlerParseDate() throws MetadataException {
-        ExifSubIFDDirectory exif = mock(ExifSubIFDDirectory.class);
-        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
-        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getDefault(), Locale.ROOT);
-        calendar.setTimeInMillis(0);
-        calendar.set(2000, 0, 1, 0, 0, 0);
-        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(
-                calendar.getTime()); // jvm default timezone as in Metadata Extractor
-        Metadata metadata = new Metadata();
-
-        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
-        assertEquals("Should be ISO date without time zone", "2000-01-01T00:00:00",
-                metadata.get(TikaCoreProperties.CREATED));
-    }
-
-    @Test
-    public void testExifHandlerParseDateFallback() throws MetadataException {
-        ExifIFD0Directory exif = mock(ExifIFD0Directory.class);
-        when(exif.containsTag(ExifIFD0Directory.TAG_DATETIME)).thenReturn(true);
-        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getDefault(), Locale.ROOT);
-        calendar.setTimeInMillis(0);
-        calendar.set(1999, 0, 1, 0, 0, 0);
-        when(exif.getDate(ExifIFD0Directory.TAG_DATETIME)).thenReturn(
-                calendar.getTime()); // jvm default timezone as in Metadata Extractor
-        Metadata metadata = new Metadata();
-
-        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
-        assertEquals("Should try EXIF Date/Time if Original is not set", "1999-01-01T00:00:00",
-                metadata.get(TikaCoreProperties.CREATED));
-    }
-
-    @Test
-    public void testExifHandlerParseDateError() throws MetadataException {
-        ExifIFD0Directory exif = mock(ExifIFD0Directory.class);
-        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
-        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(null);
-        Metadata metadata = new Metadata();
-
-        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
-        assertEquals("Parsing should proceed without date", null,
-                metadata.get(TikaCoreProperties.CREATED));
-    }
-
-    @Test
-    public void testCopyUnknownFieldsHandler() throws MetadataException {
-        Directory d = mock(Directory.class);
-        Tag t1 = mock(Tag.class);
-        when(t1.getTagName()).thenReturn("Image Description");
-        when(t1.getDescription()).thenReturn("t1");
-        Tag t2 = mock(Tag.class);
-        when(t2.getTagName()).thenReturn(Metadata.KEYWORDS);
-        when(t2.getDescription()).thenReturn("known");
-        Tag t3 = mock(Tag.class);
-        when(t3.getTagName()).thenReturn(TikaCoreProperties.DESCRIPTION.getName());
-        when(t3.getDescription()).thenReturn("known");
-        List<Tag> tags = Arrays.asList(t1, t2, t3);
-        when(d.getTags()).thenReturn(tags);
-        Metadata metadata = new Metadata();
-        new ImageMetadataExtractor.CopyUnknownFieldsHandler().handle(d, metadata);
-        assertEquals("t1", metadata.get("Image Description"));
-        assertNull("keywords should be excluded from bulk copy because it is a defined field",
-                metadata.get(Metadata.KEYWORDS));
-        assertNull(metadata.get(TikaCoreProperties.DESCRIPTION));
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.image;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import com.drew.metadata.Directory;
+import com.drew.metadata.MetadataException;
+import com.drew.metadata.Tag;
+import com.drew.metadata.exif.ExifIFD0Directory;
+import com.drew.metadata.exif.ExifSubIFDDirectory;
+import com.drew.metadata.jpeg.JpegCommentDirectory;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.metadata.TikaCoreProperties;
+import org.junit.Test;
+
+public class ImageMetadataExtractorTest {
+
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    @Test
+    public void testHandleDirectories() throws MetadataException {
+        Metadata metadata = mock(Metadata.class);
+        ImageMetadataExtractor.DirectoryHandler handler1 = mock(ImageMetadataExtractor.DirectoryHandler.class);
+        ImageMetadataExtractor e = new ImageMetadataExtractor(metadata, handler1);
+
+        Directory directory = new JpegCommentDirectory();
+        Iterator directories = mock(Iterator.class);
+        when(directories.hasNext()).thenReturn(true, false);
+        when(directories.next()).thenReturn(directory);
+        when(handler1.supports(JpegCommentDirectory.class)).thenReturn(true);
+
+        e.handle(directories);
+        verify(handler1).supports(JpegCommentDirectory.class);
+        verify(handler1).handle(directory, metadata);
+    }
+
+    @Test
+    public void testExifHandlerSupports() {
+        assertTrue(new ImageMetadataExtractor.ExifHandler().supports(ExifIFD0Directory.class));
+        assertTrue(new ImageMetadataExtractor.ExifHandler().supports(ExifSubIFDDirectory.class));
+        assertFalse(new ImageMetadataExtractor.ExifHandler().supports(Directory.class));
+        assertFalse(new ImageMetadataExtractor.ExifHandler().supports(JpegCommentDirectory.class));
+    }
+
+    @Test
+    public void testExifHandlerParseDate() throws MetadataException {
+        ExifSubIFDDirectory exif = mock(ExifSubIFDDirectory.class);
+        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
+        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getDefault(), Locale.ROOT);
+        calendar.setTimeInMillis(0);
+        calendar.set(2000, 0, 1, 0, 0, 0);
+        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(
+                calendar.getTime()); // jvm default timezone as in Metadata Extractor
+        Metadata metadata = new Metadata();
+
+        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
+        assertEquals("Should be ISO date without time zone", "2000-01-01T00:00:00",
+                metadata.get(TikaCoreProperties.CREATED));
+    }
+
+    @Test
+    public void testExifHandlerParseDateFallback() throws MetadataException {
+        ExifIFD0Directory exif = mock(ExifIFD0Directory.class);
+        when(exif.containsTag(ExifIFD0Directory.TAG_DATETIME)).thenReturn(true);
+        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getDefault(), Locale.ROOT);
+        calendar.setTimeInMillis(0);
+        calendar.set(1999, 0, 1, 0, 0, 0);
+        when(exif.getDate(ExifIFD0Directory.TAG_DATETIME)).thenReturn(
+                calendar.getTime()); // jvm default timezone as in Metadata Extractor
+        Metadata metadata = new Metadata();
+
+        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
+        assertEquals("Should try EXIF Date/Time if Original is not set", "1999-01-01T00:00:00",
+                metadata.get(TikaCoreProperties.CREATED));
+    }
+
+    @Test
+    public void testExifHandlerParseDateError() throws MetadataException {
+        ExifIFD0Directory exif = mock(ExifIFD0Directory.class);
+        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
+        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(null);
+        Metadata metadata = new Metadata();
+
+        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
+        assertEquals("Parsing should proceed without date", null,
+                metadata.get(TikaCoreProperties.CREATED));
+    }
+
+    @Test
+    public void testCopyUnknownFieldsHandler() throws MetadataException {
+        Directory d = mock(Directory.class);
+        Tag t1 = mock(Tag.class);
+        when(t1.getTagName()).thenReturn("Image Description");
+        when(t1.getDescription()).thenReturn("t1");
+        Tag t2 = mock(Tag.class);
+        when(t2.getTagName()).thenReturn(Metadata.KEYWORDS);
+        when(t2.getDescription()).thenReturn("known");
+        Tag t3 = mock(Tag.class);
+        when(t3.getTagName()).thenReturn(TikaCoreProperties.DESCRIPTION.getName());
+        when(t3.getDescription()).thenReturn("known");
+        List<Tag> tags = Arrays.asList(t1, t2, t3);
+        when(d.getTags()).thenReturn(tags);
+        Metadata metadata = new Metadata();
+        new ImageMetadataExtractor.CopyUnknownFieldsHandler().handle(d, metadata);
+        assertEquals("t1", metadata.get("Image Description"));
+        assertNull("keywords should be excluded from bulk copy because it is a defined field",
+                metadata.get(Metadata.KEYWORDS));
+        assertNull(metadata.get(TikaCoreProperties.DESCRIPTION));
+    }
+
+}