java.nio.file.spi.FileTypeDetector Class in Java Last Updated : 13 Apr, 2021 Comments Improve Suggest changes Like Article Like Report java.nio.file.spi.FileTypeDetector Class extends java.lang.Object Class. FileTypeDetector Class contain method to know about the content type of given file. Class declaration: public abstract class FileTypeDetector extends ObjectConstructor: ConstructorDescriptionprotected FileTypeDetector()It is used the creation of a new object of FileTypeDetector class. Method: MethodDescriptionprobeContentType(Path path)It is used to guess the content type of the given file. abstract String probeContentType(Path path): It is used to guess the content type of the given file. To know the content type of the file this method may examine the filename, use file attribute, or even examine the bytes in the file. The way of examination of file solely depends on the implementation. Parameters: path - the path of the file whose content type is to be guessed Returns: The content type of the given file.If the file type is not recognized it returns null. Exception: IOException - if an I/O error occursSecurityException - If the security manager denies access to the given file. Java // Java program to illustrate use of probeContentType() // method of FileTypeDetector class import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class GFG { public static void main(String[] args) { try { // create object of Path Path path = (Path)Paths.get("/usr", "local", "bin", "file.txt"); // Print content type of the file present at // this path System.out.println( Files.probeContentType(path)); } catch (IOException e) { e.printStackTrace(); } } } Output: text/plain Comment More infoAdvertise with us Next Article java.nio.file.spi.FileTypeDetector Class in Java A abhinavjain194 Follow Improve Article Tags : Java Java-NIO package Practice Tags : Java Similar Reads java.nio.file.FileStore Class in Java Java.nio.file is a package in java that consists of the FileStore class. FileStore class is a class that provides methods for the purpose of performing some operations on file store. FileStore is a class that extends Object from java.lang package. And few methods the FileStore class can inherit from 4 min read java.nio.file.FileSystem class in java java.nio.file.FileSystem class provides an interface to a file system. The file system acts as a factory for creating different objects like Path, PathMatcher, UserPrincipalLookupService, and WatchService. This object help to access the files and other objects in the file system. Syntax: Class decla 4 min read java.nio.file.Paths Class in Java java.nio.file.Paths class contains static methods for converting path string or URI into Path. Class declaration : public final class Paths extends ObjectMethods: MethodDescriptionget(String first, String... more) This method converts a path string, or a sequence of strings that when joined form a p 2 min read java.nio.file.attribute.FileTime Class in Java The java.nio.file.attribute.FileTime class is used to get a value representing this file's timestamp i.e, the time when this file was last modified, accessed, or created. Class Declaration: public final class FileTime extends Object implements Comparable<FileTime>Methods: MethodDescriptioncomp 2 min read java.nio.FloatBuffer Class in Java A Buffer object can be termed as a container for a fixed amount of data. The buffer acts as a storing box, or temporary staging area, where data can be stored and later retrieved according to the usage. Java Buffer classes are the foundation or base upon which java.nio is built. Float buffers are cr 4 min read java.nio.file.SimpleFileVisitor Class in Java The java.nio.file.SimpleFileVisitor Class is used to visit all the files in a directory and to re-throw I/O exceptions whenever an I/O error occurs. Class declaration : public class SimpleFileVisitor<T> extends Object implements FileVisitor<T>Constructor: protected SimpleFileVIsitor(): C 3 min read java.nio.file.LinkPermission Class in Java The java.nio.file.LinkPermission class handles permissions for link creation operations. The permission allowed by these class are as follows: Permission name What permission allows Risk of granting this permission hard This permission allows adding an existing file to a directory. This operation is 3 min read Java.io.InputStream Class in Java Java InputStream class is the superclass of all the io classes i.e. representing an input stream of bytes. It represents an input stream of bytes. Applications that are defining a subclass of the Java InputStream class must provide a method, that returns the next byte of input. A reset() method is i 3 min read Java FileDescriptor Class java.io.FileDescriptor class in Java works for opening a file having a specific name. If there is any content present in that file it will first erase all that content and put "Beginning of Process" as the first line. Instances of the file descriptor class serve as an opaque handle to the underlying 4 min read java.nio.file.attribute.AclEntry Class in Java ACL entries are Examined by this class is validating on the ACL model declared in RFC 3530: Network File System i.e.(NFS) version of 4th Protocol and having four components within it as follows characteristics as follows:Â This type of component are determining if the entry grants or denies its acce 3 min read Like