站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

FileEncodingQueryImplementation (General Queries API) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.queries/1 1.10

org.netbeans.spi.queries
Class FileEncodingQueryImplementation

java.lang.Object
  extended by org.netbeans.spi.queries.FileEncodingQueryImplementation

public abstract class FileEncodingQueryImplementation
extends Object

Information about encoding of a file.

A default implementations are registered by the org.netbeans.modules.projectapi module which firstly looks up the implementation of this interface in the DataObject lookup. When available it delegates to it. When the implementation isn't available in the DataObject lookup or it returns null it tries to find a project corresponding to the file and checks whether that project has an implementation of this interface in its lookup. If so, it delegates to that implementation. Therefore it is not generally necessary for a project type provider nor data loader to register its own global implementation of this query.

Typical implementation returns a Charset for recognized file. The implementation which needs to analyze the content of the file (XML, HTML) should implement a subclass of the Charset and provide own CharsetEncoder end CharsetDecoder which buffer the input up to 4 KB and either delegate to the correct Charset when the encoding is found in the buffer or signal that they are not able to process the file and other Charset should be used by calling the throwUnknownEncoding() method.

Since:
org.netbeans.modules.projectapi/1 1.13
See Also:
1.9

Constructor Summary
FileEncodingQueryImplementation()
           
 
Method Summary
abstract  Charset getEncoding(FileObject file)
          Returns encoding of a given file.
protected static void throwUnknownEncoding()
          By calling this method the CharsetEncoder and CharsetDecoder signal that they are not able to handle the document and the other Charset should be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileEncodingQueryImplementation

public FileEncodingQueryImplementation()
Method Detail

getEncoding

public abstract Charset getEncoding(FileObject file)
Returns encoding of a given file.

Parameters:
file - to find an encoding for
Returns:
encoding which should be used for given file or null when nothing is known about the file encoding.

throwUnknownEncoding

protected static void throwUnknownEncoding()
By calling this method the CharsetEncoder and CharsetDecoder signal that they are not able to handle the document and the other Charset should be used. This method may be called during processing the first 4 KB of data and before any output has been written.


org.netbeans.modules.queries/1 1.10

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.