org.apache.tika.language
Class ProfilingWriter

java.lang.Object
  extended by java.io.Writer
      extended by org.apache.tika.language.ProfilingWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class ProfilingWriter
extends java.io.Writer

Writer that builds a language profile based on all the written content.

Since:
Apache Tika 0.5

Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
ProfilingWriter()
           
ProfilingWriter(LanguageProfile profile)
           
 
Method Summary
 void close()
           
 void flush()
          Ignored.
 LanguageIdentifier getLanguage()
          Returns the language that best matches the current state of the language profile.
 LanguageProfile getProfile()
          Returns the language profile being built by this writer.
 void write(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfilingWriter

public ProfilingWriter(LanguageProfile profile)

ProfilingWriter

public ProfilingWriter()
Method Detail

getProfile

public LanguageProfile getProfile()
Returns the language profile being built by this writer. Note that the returned profile gets updated whenever new characters are written. Use the getLanguage() method to get the language that best matches the current state of the profile.

Returns:
language profile

getLanguage

public LanguageIdentifier getLanguage()
Returns the language that best matches the current state of the language profile.

Returns:
language that best matches the current profile

write

public void write(char[] cbuf,
                  int off,
                  int len)
Specified by:
write in class java.io.Writer

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

flush

public void flush()
Ignored.

Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.