public abstract class FileEncodingQueryImplementation extends Object
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.
| Constructor and Description |
|---|
FileEncodingQueryImplementation() |
| Modifier and Type | Method and Description |
|---|---|
abstract Charset |
getEncoding(FileObject file)
Returns encoding of a given file or folder.
|
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. |
public abstract Charset getEncoding(FileObject file)
file - to find an encoding forprotected static void throwUnknownEncoding()
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.Built on August 24 2014. | Portions Copyright 1997-2014 Sun Microsystems, Inc. All rights reserved.