Spec-Zone .ru
спецификации, руководства, описания, API
|
|
Java™ Platform Standard Ed. 7 DRAFT ea-b118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.nio.file.spi.FileTypeDetector
public abstract class FileTypeDetector extends Object
A file type detector for probing a file to guess its file type.
A file type detector is a concrete implementation of this class, has a zero-argument constructor, and implements the abstract methods specified below.
The means by which a file type detector determines the file type is highly implementation specific. A simple implementation might examine the file extension (a convention used in some platforms) and map it to a file type. In other cases, the file type may be stored as a file attribute or the bytes in a file may be examined to guess its file type.
Files.probeContentType(FileRef)
Modifier | Constructor and Description |
---|---|
protected |
FileTypeDetector()
Initializes a new instance of this class. |
Modifier and Type | Method and Description |
---|---|
abstract String |
probeContentType(FileRef file)
Probes the given file to guess its content type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FileTypeDetector()
SecurityException
- If a security manager has been installed and it denies
RuntimePermission
("fileTypeDetector")Method Detail |
---|
public abstract String probeContentType(FileRef file) throws IOException
The means by which this method determines the file type is highly implementation specific. It may simply examine the file name, it may use a file attribute, or it may examines bytes in the file.
The probe result is the string form of the value of a
Multipurpose Internet Mail Extension (MIME) content type as
defined by
file
- The file to probenull
if the file type is not
recognizedIOException
- An I/O error occursSecurityException
- If the implementation requires to access the file, and a
security manager is installed, and it denies an unspecified
permission required by a file system provider implementation.
If the file reference is associated with the default file system
provider then the SecurityManager.checkRead(String)
method
is invoked to check read access to the file.Files.probeContentType(java.nio.file.FileRef)
|
Java™ Platform Standard Ed. 7 DRAFT ea-b118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1993, 2010, Oracle Corporation. All rights reserved.