Programación

1º DAM/DAW - Curso 2023-2024

User Tools

Site Tools


apuntes:ficheros

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
apuntes:ficheros [2021/02/22 13:36] – [Propiedades del Sistema] Santiago Faciapuntes:ficheros [2023/05/28 12:12] (current) – [Files] Santiago Faci
Line 330: Line 330:
 </code> </code>
  
 +===== Paquete Java NIO 2 =====
 +
 +No includo desde siempre, el paquete Java NIO 2, mejora las clases y métodos disponibles para trabajar con ficheros, sistemas de ficheros y todo lo relacionado con entrada/salida.
 +
 +==== FileSystems ====
 +
 +Es una factoría que permite acceder a un sistema de ficheros:
 +  * //static FileSystem getDefault()//: Devuelve el sistema de ficheros por defecto
 +
 +==== FileSystem ====
 +
 +Representa un sistema de ficheros
 +
 +  * //Path getPath(String first, String. . . more)//: Convierte una ruta en un objeto Path
 +  * //String getSeparator()//: Devuelve el separador de diretorio del sistema de ficheros
 +  * //FileSystemProvider getProvider()//: Devuelve el proveedor del sistema de ficheros
 +
 +==== Paths ====
 +
 +Contiene métodos estáticos para obtener objetos Path a partir de cadenas 
 +  * //static Path get(String first, String... more)//
 +
 +==== Path ====
 +
 +Representa un fichero dentro del sistema de ficheros.
 +Podemos acceder al fichero y a su información a través de las propiedades y métodos de la clase
 +  * //boolean endsWith(String string)//
 +  * //boolean endsWith(Path path)//
 +  * //int getNameCount()//
 +  * //Path getParent()//
 +  * //boolean startsWith(String string)//
 +  * //File toFile()//
 +  * //String toString()//
 +
 +==== Files ====
 +
 +Contiene métodos estáticos que operan con ficheros y directorios
 +  * //static long copy(. . .)//
 +  * //static Path createFile(. . .)//
 +  * //static void delete(. . .)//
 +  * //static boolean deleteIfExists(Path path)//
 +  * //static Stream<String> lines(Path path)//
 +  * //static Stream<Path> list(Path dir)//
 +  * //static List<String> readAllLines(Path path)//
 +  * //static List<String> readAllLines(Path path, Charset cs)//
 +  * //static String readString(Path path)//
 +  * //static long size(Path path)//
 +  * //static Stream<Path> walk(Path start, int maxDepth, FileVisitOption... options)//
 +  * //static Stream<Path> walk(Path start, FileVisitOption. . . options)//
  
 ---- ----
  
-(c) 2019-2021 Santiago Faci+(c) 2019-{{date>%Y}} Santiago Faci
apuntes/ficheros.1614000996.txt.gz · Last modified: 2021/02/22 13:36 by Santiago Faci