public class Enry
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static Guess |
unknownLanguage |
| Constructor and Description |
|---|
Enry() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getLanguage(java.lang.String filename,
byte[] content)
Returns the language of the given file based on the filename and its
contents.
|
static Guess |
getLanguageByContent(java.lang.String filename,
byte[] content)
Returns detected language by its content.
|
static Guess |
getLanguageByEmacsModeline(byte[] content)
Returns detected language by its emacs modeline.
|
static Guess |
getLanguageByExtension(java.lang.String filename)
Returns detected language by the extension of the filename.
|
static Guess |
getLanguageByFilename(java.lang.String filename)
Returns detected language by its filename.
|
static Guess |
getLanguageByModeline(byte[] content)
Returns detected language by its modeline.
|
static Guess |
getLanguageByShebang(byte[] content)
Returns detected language by its shebang.
|
static Guess |
getLanguageByVimModeline(byte[] content)
Returns detected language by its vim modeline.
|
static java.lang.String[] |
getLanguageExtensions(java.lang.String language)
Returns all the possible extensions for a file in the given language.
|
static java.lang.String[] |
getLanguages(java.lang.String filename,
byte[] content)
Returns all possible languages for the given file.
|
static java.lang.String |
getMimeType(java.lang.String path,
java.lang.String language)
Returns the mime type of the file.
|
static boolean |
isAuxiliaryLanguage(java.lang.String language)
Returns whether the given language is auxiliary or not.
|
static boolean |
isBinary(byte[] content)
Reports whether the given file content is binary or not.
|
static boolean |
isConfiguration(java.lang.String path)
Reports whether the given file or directory is a config file or directory.
|
static boolean |
isDocumentation(java.lang.String path)
Reports whether the given file or directory it's documentation.
|
static boolean |
isDotFile(java.lang.String path)
Reports whether the given file is a dotfile.
|
static boolean |
isImage(java.lang.String path)
Reports whether the given path is an image or not.
|
static boolean |
isVendor(java.lang.String path)
Reports whether the given path is a vendor path or not.
|
public static final Guess unknownLanguage
public static boolean isAuxiliaryLanguage(java.lang.String language)
language - name of the language, e.g. PHP, HTML, ...public static java.lang.String getLanguage(java.lang.String filename,
byte[] content)
filename - name of the file with the extensioncontent - array of bytes with the contents of the file (the code)public static Guess getLanguageByContent(java.lang.String filename, byte[] content)
filename - name of the file with the extensioncontent - of the filepublic static Guess getLanguageByEmacsModeline(byte[] content)
content - of the filepublic static Guess getLanguageByExtension(java.lang.String filename)
filename - of the filepublic static Guess getLanguageByShebang(byte[] content)
content - of the filepublic static Guess getLanguageByFilename(java.lang.String filename)
filename - of the filepublic static Guess getLanguageByModeline(byte[] content)
content - of the filepublic static Guess getLanguageByVimModeline(byte[] content)
content - of the filepublic static java.lang.String[] getLanguageExtensions(java.lang.String language)
language - to get extensions frompublic static java.lang.String[] getLanguages(java.lang.String filename,
byte[] content)
filename - of the filecontent - of the filepublic static java.lang.String getMimeType(java.lang.String path,
java.lang.String language)
path - of the filelanguage - of the filepublic static boolean isBinary(byte[] content)
content - of the filepublic static boolean isConfiguration(java.lang.String path)
path - of the file or directorypublic static boolean isDocumentation(java.lang.String path)
path - of the file or directory. It must not contain its parents and
if it's a directory it must end in a slash e.g. "docs/" or
"foo.json".public static boolean isDotFile(java.lang.String path)
path - of the filepublic static boolean isImage(java.lang.String path)
path - of the filepublic static boolean isVendor(java.lang.String path)
path - of the file or directory