Index: tika-parsers/src/test/java/org/apache/tika/parser/swf/SWFParserTest.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parser/swf/SWFParserTest.java	(revision 0)
+++ tika-parsers/src/test/java/org/apache/tika/parser/swf/SWFParserTest.java	(revision 0)
@@ -0,0 +1,63 @@
+/*
+ * 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.swf;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.AutoDetectParser;
+import org.apache.tika.parser.ParseContext;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.sax.BodyContentHandler;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Test case for parsing swf files.
+ */
+public class SWFParserTest extends TestCase {
+  
+  public void testSWFParsing() throws Exception {
+    Parser parser = new AutoDetectParser(); // Should auto-detect!
+    ContentHandler handler = new BodyContentHandler();
+    Metadata metadata = new Metadata();
+    
+    InputStream stream = SWFParserTest.class
+        .getResourceAsStream("/test-documents/test.swf");
+    try {
+      parser.parse(stream, handler, metadata,new ParseContext());
+    } finally {
+      stream.close();
+    }
+    
+    String content = handler.toString();
+    assertTrue(content.contains("Mix."));
+    assertTrue(content.contains("Edit."));
+    assertTrue(content.contains("Master."));
+    assertTrue(content.contains("Compose."));
+    assertTrue(content.contains("Animate."));
+    assertTrue(content.contains("With a single suite of powerful tools"));
+    assertTrue(content.contains("that work together as one."));
+    assertTrue(content.contains("World-class video and audio tools that bring"));
+    assertTrue(content
+        .contains("new power and efficiency to your film, video,"));
+    assertTrue(content.contains("DVD, and web workflows."));
+    assertTrue(content.contains("Learn more."));
+  }
+  
+}
Index: tika-parsers/src/test/resources/test-documents/test.swf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tika-parsers/src/test/resources/test-documents/test.swf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tika-parsers/src/main/java/org/apache/tika/parser/swf/ExtractText.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parser/swf/ExtractText.java	(revision 0)
+++ tika-parsers/src/main/java/org/apache/tika/parser/swf/ExtractText.java	(revision 0)
@@ -0,0 +1,147 @@
+package org.apache.tika.parser.swf;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import com.anotherbigidea.flash.interfaces.SWFText;
+import com.anotherbigidea.flash.interfaces.SWFVectors;
+import com.anotherbigidea.flash.structs.AlphaColor;
+import com.anotherbigidea.flash.structs.Color;
+import com.anotherbigidea.flash.structs.Matrix;
+import com.anotherbigidea.flash.structs.Rect;
+import com.anotherbigidea.flash.writers.SWFTagTypesImpl;
+
+/**
+ * Taken from http://www.anotherbigidea.com/javaswf/samples/ExtractText.java
+ * 
+ * Shows how to parse a Flash movie and extract all the text in Text symbols and
+ * the initial text in Edit Fields. Output is to System.out.
+ * 
+ * A "pipeline" is set up in the main method:
+ * 
+ * SWFReader-->TagParser-->ExtractText
+ * 
+ * SWFReader reads the input SWF file and separates out the header and the tags.
+ * The separated contents are passed to TagParser which parses out the
+ * individual tag types and passes them to ExtractText.
+ * 
+ * ExtractText extends SWFTagTypesImpl and overrides some methods.
+ */
+public class ExtractText extends SWFTagTypesImpl {
+  /**
+   * Store font info keyed by the font symbol id Each entry is an int[] of
+   * character codes for the corresponding font glyphs (An empty array denotes a
+   * System Font)
+   */
+  protected HashMap fontCodes = new HashMap();
+  
+  private StringBuffer textBuffer = new StringBuffer();
+  
+  public ExtractText() {
+    super(null);
+  }
+  
+  public String getText() {
+    return textBuffer.toString();
+  }
+  
+  /**
+   * SWFTagTypes interface Save the Text Font character code info
+   */
+  public void tagDefineFontInfo(int fontId, String fontName, int flags,
+      int[] codes) throws IOException {
+    fontCodes.put(new Integer(fontId), codes);
+  }
+  
+  /**
+   * SWFTagTypes interface Save the character code info
+   */
+  public SWFVectors tagDefineFont2(int id, int flags, String name,
+      int numGlyphs, int ascent, int descent, int leading, int[] codes,
+      int[] advances, Rect[] bounds, int[] kernCodes1, int[] kernCodes2,
+      int[] kernAdjustments) throws IOException {
+    fontCodes.put(new Integer(id), (codes != null) ? codes : new int[0]);
+    
+    return null;
+  }
+  
+  /**
+   * SWFTagTypes interface Dump any initial text in the field
+   */
+  public void tagDefineTextField(int fieldId, String fieldName,
+      String initialText, Rect boundary, int flags, AlphaColor textColor,
+      int alignment, int fontId, int fontSize, int charLimit, int leftMargin,
+      int rightMargin, int indentation, int lineSpacing) throws IOException {
+    if (initialText != null) {
+      textBuffer.append(initialText);
+    }
+  }
+  
+  /**
+   * SWFTagTypes interface
+   */
+  public SWFText tagDefineText(int id, Rect bounds, Matrix matrix)
+      throws IOException {
+    return new TextDumper(textBuffer);
+  }
+  
+  /**
+   * SWFTagTypes interface
+   */
+  public SWFText tagDefineText2(int id, Rect bounds, Matrix matrix)
+      throws IOException {
+    return new TextDumper(textBuffer);
+  }
+  
+  public class TextDumper implements SWFText {
+    protected Integer fontId;
+    protected boolean firstY = true;
+    private StringBuffer buffer;
+    
+    TextDumper(StringBuffer buff) {
+      buffer = buff;
+    }
+    
+    public void font(int fontId, int textHeight) {
+      this.fontId = new Integer(fontId);
+    }
+    
+    public void setY(int y) {
+      if (firstY) firstY = false;
+      else buffer.append("\n"); // Change in Y - dump a new line
+    }
+    
+    public void text(int[] glyphIndices, int[] glyphAdvances) {
+      int[] codes = (int[]) fontCodes.get(fontId);
+      if (codes == null) {
+        // System.out.println("\n**** COULD NOT FIND FONT INFO FOR TEXT ****\n");
+        return;
+      }
+      
+      // --Translate the glyph indices to character codes
+      char[] chars = new char[glyphIndices.length];
+      
+      for (int i = 0; i < chars.length; i++) {
+        int index = glyphIndices[i];
+        
+        if (index >= codes.length) // System Font ?
+        {
+          chars[i] = (char) index;
+        } else {
+          chars[i] = (char) (codes[index]);
+        }
+      }
+      
+      buffer.append(chars);
+    }
+    
+    public void color(Color color) {}
+    
+    public void setX(int x) {}
+    
+    public void done() {
+      buffer.append("\n");
+    }
+  }
+  
+}
Index: tika-parsers/src/main/java/org/apache/tika/parser/swf/SWFParser.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parser/swf/SWFParser.java	(revision 0)
+++ tika-parsers/src/main/java/org/apache/tika/parser/swf/SWFParser.java	(revision 0)
@@ -0,0 +1,80 @@
+/**
+ * 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.swf;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.ParseContext;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.sax.XHTMLContentHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+import com.anotherbigidea.flash.readers.SWFReader;
+import com.anotherbigidea.flash.readers.TagParser;
+import com.anotherbigidea.io.InStream;
+
+/**
+ * Parser for Flash SWF files. Based on JavaSWF and similar to A. Bialecki's
+ * implementation for Nutch except that we do not handle text from the actions
+ * or structured URLS. URLs can be obtained from the text extracted using
+ * ParserPostProcessor
+ * 
+ * @author Julien Nioche
+ */
+public class SWFParser implements Parser {
+  
+  /**
+   * @deprecated This method will be removed in Apache Tika 1.0.
+   */
+  public void parse(InputStream stream, ContentHandler handler,
+      Metadata metadata) throws IOException, SAXException, TikaException {
+    parse(stream, handler, metadata, new ParseContext());
+  }
+  
+  public void parse(InputStream stream, ContentHandler handler,
+      Metadata metadata, ParseContext context) throws IOException,
+      SAXException, TikaException {
+    try {
+      ExtractText extractor = new ExtractText();
+      
+      // TagParser implements SWFTags and drives a SWFTagTypes interface
+      TagParser parser = new TagParser(extractor);
+      
+      // SWFReader reads an input file and drives a SWFTags interface
+      SWFReader reader = new SWFReader(parser, new InStream(stream));
+      
+      // read the input SWF file and pass it through the interface pipeline
+      reader.readFile();
+      String text = extractor.getText();
+      // we leave the extraction of links from the text to the
+      // ParserPostProcessor
+      
+      XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
+      xhtml.startDocument();
+      xhtml.element("p", extractor.getText());
+      xhtml.endDocument();
+    } catch (Exception e) {
+      throw new TikaException("Error parsing an SWF document", e);
+    }
+  }
+  
+}
Index: tika-parsers/pom.xml
===================================================================
--- tika-parsers/pom.xml	(revision 884183)
+++ tika-parsers/pom.xml	(working copy)
@@ -119,8 +119,11 @@
        <artifactId>metadata-extractor</artifactId>
        <version>2.4.0-beta-1</version>
     </dependency>
-
-    
+    <dependency>
+       <groupId>com.anotherbigidea</groupId>
+       <artifactId>javaswf</artifactId>
+       <version>CVS-SNAPSHOT-1</version>
+    </dependency>
   </dependencies>
 
   <build>
Index: tika-core/src/main/resources/org/apache/tika/tika-config.xml
===================================================================
--- tika-core/src/main/resources/org/apache/tika/tika-config.xml	(revision 884183)
+++ tika-core/src/main/resources/org/apache/tika/tika-config.xml	(working copy)
@@ -171,6 +171,10 @@
                 <mime>application/epub+zip</mime>
         </parser>
 
+        <parser name="parse-swf" class="org.apache.tika.parser.swf.SWFParser">
+                <mime>application/x-shockwave-flash</mime>
+        </parser>
+
     </parsers>
 
-</properties>
\ No newline at end of file
+</properties>
