FileSystem getSeparator() method in Java with Examples Last Updated : 02 Aug, 2021 Comments Improve Suggest changes Like Article Like Report The getSeparator() method of a FileSystem class is used to return the name separator for this file system as a string. The name separator is used to separate names in a path string. In the case of the default provider, this method returns the same separator as String.Syntax: public abstract String getSeparator() Parameters: This method accepts nothing.Return value: This method returns the same separator as String.Below programs illustrate the getSeparator() method: Program 1: Java // Java program to demonstrate // FileSystem.getSeparator() method import java.nio.file.FileSystem; import java.nio.file.Path; import java.nio.file.Paths; public class GFG { public static void main(String[] args) { // create the object of Path Path path = Paths.get( "C:\\Movies\\document.txt"); // get FileSystem object FileSystem fs = path.getFileSystem(); // apply getSeparator() methods String separator = fs.getSeparator(); // print System.out.println("Separator: " + separator); } } Output: Program 2: Java // Java program to demonstrate // FileSystem.getSeparator() method import java.nio.file.FileSystem; import java.nio.file.Path; import java.nio.file.Paths; public class GFG { public static void main(String[] args) { // create the object of Path Path path = Paths.get( "E:// Tutorials// file.txt"); // get FileSystem object FileSystem fs = path.getFileSystem(); // apply getSeparator() methods String separator = fs.getSeparator(); // print System.out.println("File Separator: " + separator); } } Output: References: https://docs.oracle.com/javase/10/docs/api/java/nio/file/FileSystem.html#getSeparator() Comment More infoAdvertise with us Next Article FileSystem getSeparator() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java.nio.file package Java-FileSystem Practice Tags : Java Similar Reads Files getFileStore() method in Java with Examples getFileStore() method of java.nio.file.Files help us to return the FileStore object which represents the file store where a file is located. Once you get a reference to the FileStore you can apply filestore type of operation to get information of filestore. Syntax: public static FileStore getFileSto 2 min read FileSystem getRootDirectories() method in Java with Examples The getRootDirectories() method of a FileSystem class is used to return an Iterator object to iterate over the paths of the root directories for this File System. A file system is composed of a number of distinct file hierarchies, each with its own top-level root directory and each element in the re 2 min read FileStore getUsableSpace() method in Java with Examples The getUsableSpace() method of a FileStore class is used to return the number of bytes available to this Java virtual machine on the file store. This method is useful to check free space. This method returns the available usable space as a long value. Syntax: public abstract long getUsableSpace() th 2 min read FileStore getTotalSpace() method in Java with Examples The getTotalSpace() method of a FileStore class is used to return total size of the file store, in bytes. This method returns this total size as a long value. Syntax: public abstract long getTotalSpace() throws IOException Parameters: This method accepts nothing. Return value: This method returns th 2 min read FileSystem isOpen() method in Java with Examples The isOpen() method of a FileSystem class is used to return true if file system is open. This method is very helpful to know filesystem is open or not. File systems created by the default provider are always open. Syntax: public abstract boolean isOpen() Parameters: This method accepts nothing. Retu 2 min read File getUsableSpace() method in java with examples The getUsableSpace() function is a part of File class in Java . This function returns the unallocated size of the partition denoted by the abstract pathname, if the pathname does not exist then it returns 0L. This function is more accurate than the getFreeSpace() function as it returns the free spac 2 min read FileStore getBlockSize() method in Java with Examples The getBlockSize() method of a FileStore class is used to return the number of bytes per block in this file store Object. Every File storage is organized into discrete sequences of bytes called blocks and a block is the smallest storage unit of a file store. Every read and write operation is perform 2 min read File getFreeSpace() method in Java with examples The getFreeSpace() function is a part of File class in Java. This function returns the unallocated size of the partition denoted by the abstract pathname, if the pathname does not exist then it returns 0L. This function gives a hint of the unallocated space of the partition but does not give any gua 2 min read File getTotalSpace() method in Java with examples The getTotalSpace() function is a part of File class in Java . This function returns the total size of the partition denoted by the abstract pathname, if the pathname does not exist then it returns 0L. Function signature: public long getTotalSpace() Syntax: long var = file.getTotalSpace(); Parameter 2 min read FileInputStream getFD() Method in Java with Examples Java.io.FileInputStream.getFD() method is a part of Java.io.FileInputStream class. This method will return the FileDescriptor object associated with the file input stream. getFD() method is declared as final that means getFD() cannot be overridden in the subclassesFileDescriptor object that we wil 2 min read Like