org.netbeans.modules.queries/1 1.17.1

org.netbeans.api.queries
Class FileEncodingQuery

java.lang.Object
  extended by org.netbeans.api.queries.FileEncodingQuery

public class FileEncodingQuery
extends Object

The query is used for finding encoding of files. The query should be used when reading or writing files to use the correct encoding.

Since:
org.netbeans.modules.queries/1 1.9
See Also:
FileEncodingQueryImplementation

Method Summary
static Charset getDefaultEncoding()
          Returns the encoding which should be used for newly created projects.
static Charset getEncoding(FileObject file)
          Returns encoding of given file.
static void setDefaultEncoding(Charset encoding)
          Sets the encoding which should be used for newly created projects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEncoding

public static Charset getEncoding(FileObject file)
Returns encoding of given file. A folder also may be passed to this method in an attempt to get the encoding for all files in, for example, a Java source root.

Parameters:
file - to find an encoding for
Returns:
encoding which should be used for given file, never returns null.
Throws:
IllegalArgumentException - if file parameter is null.

getDefaultEncoding

public static Charset getDefaultEncoding()
Returns the encoding which should be used for newly created projects. The typical user of this method is a code generating new projects. The returned value is a last used encoding set for project.

Returns:
the default encoding

setDefaultEncoding

public static void setDefaultEncoding(Charset encoding)
Sets the encoding which should be used for newly created projects. The typical user of this method is a project customizer, when the user sets a new encoding the customizer code should update the defaul encoding by this method.

Parameters:
encoding - the new default encoding
Throws:
IllegalArgumentException - if encoding parameter is null.

org.netbeans.modules.queries/1 1.17.1

Built on September 7 2010.  |  Portions Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.