SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
Язык Java




Объект File
  java.io
File
●   public static final char separatorChar
●   public static final String separator
●   public static final char pathSeparatorChar
●   public static final String pathSeparator
●   public File(String pathname)
●   public File(String parent, String child)
●   public File(File parent, String child)
●   public File(URI uri)
●   public String getName()
●   public String getParent()
●   public File getParentFile()
●   public String getPath()
●   public boolean isAbsolute()
●   public String getAbsolutePath()
●   public File getAbsoluteFile()
●   public String getCanonicalPath() throws IOException
●   public File getCanonicalFile() throws IOException
File (продолжение)
●   public boolean canRead()
●   public boolean canWrite()
●   public boolean exists()
●   public boolean isDirectory()
●   public boolean isFile()
●   public boolean isHidden()
●   public long lastModified()
●   public long length()
●   public boolean createNewFile() throws IOException
●   public boolean delete()
●   public String[] list()
●   public String[] list(FilenameFilter filter)
●   public File[] listFiles()
●   public File[] listFiles(FilenameFilter filter)
●   public File[] listFiles(FileFilter filter)
●   public boolean mkdir()
●   public boolean mkdirs()
●   public boolean renameTo(File dest)
File (продолжение)
●   public boolean setReadOnly()
●   public boolean setWritable(boolean writable, boolean
    ownerOnly)
●   public boolean setWritable(boolean writable)
●   public boolean setReadable(boolean readable, boolean
    ownerOnly)
●   public boolean setReadable(boolean readable)
●   public boolean setExecutable(boolean executable, boolean
    ownerOnly)
●   public boolean setExecutable(boolean executable)
●   public boolean canExecute()
●   public long getTotalSpace()
●   public long getFreeSpace()
●   public long getUsableSpace()
●   public static File createTempFile(String prefix, String suffix,
    File directory)
●   public static File createTempFile(String prefix, String suffix)
    throws IOException
Пример использования
●   private File f;
    private Date d;
    private File f1;
    public FileTestClass(String name, String name2)
    {
       f1=new File(name);
       d=new Date(f1.lastModified());
       f=new File(name2);
    }

    public String[] outAllFiles()
    {
      File[] fs=f.listFiles(new MyFilter(d));
      String[] ss=new String[fs.length];
      for(int i=0;i<fs.length;++i)
         ss[i]=fs[i].getPath();
      return ss;
    }
Интерфейс FileFilter
●   public interface FileFilter{
      boolean accept(File pathname);
    }
Пример использования

●   public class MyFilter implements FileFilter{
       private Date date;
       public MyFilter(Date date)
      {
          this.date=date;
       }

        public boolean accept(File pathname) {
          Date date1 = new Date(pathname.lastModified());
          return (date.getTime()>=date1.getTime());
        }
    }
Интерфейс FilanameFilter

●   interface FilenameFilter {
       boolean accept(File dir, String name);
    }
Работа со временем

●   class Date
    ●   public Date(long date)
●   class GregorianCalendar
    ●   public GregorianCalendar(int year, int month, int
        dayOfMonth, int hourOfDay, int minute, int second)
    ●   public final Date getTime()
    ●   public final void setTime(Date date)
Конец




            Вопросы
e-mail: a.bovanenko@gmail.com

Contenu connexe

Tendances

Migrating from drupal to plone with transmogrifier
Migrating from drupal to plone with transmogrifierMigrating from drupal to plone with transmogrifier
Migrating from drupal to plone with transmogrifierClayton Parker
 
java copy file program
java copy file programjava copy file program
java copy file programGlen Pais
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes
 
Closures for Java
Closures for JavaClosures for Java
Closures for Javanextlib
 
File input output in Java
File input output in JavaFile input output in Java
File input output in JavaFiverr
 
C++ prgms io file unit 7
C++ prgms io file unit 7C++ prgms io file unit 7
C++ prgms io file unit 7Ananda Kumar HN
 
MessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization formatMessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization formatLarry Nung
 
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume LaforgeGroovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume LaforgeGuillaume Laforge
 
Transmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less painTransmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less painLennart Regebro
 
Next Generation Language Go
Next Generation Language GoNext Generation Language Go
Next Generation Language GoYoichiro Shimizu
 
Clojure made really really simple
Clojure made really really simpleClojure made really really simple
Clojure made really really simpleJohn Stevenson
 

Tendances (14)

Migrating from drupal to plone with transmogrifier
Migrating from drupal to plone with transmogrifierMigrating from drupal to plone with transmogrifier
Migrating from drupal to plone with transmogrifier
 
java copy file program
java copy file programjava copy file program
java copy file program
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
 
Go破壊
Go破壊Go破壊
Go破壊
 
Closures for Java
Closures for JavaClosures for Java
Closures for Java
 
File input output in Java
File input output in JavaFile input output in Java
File input output in Java
 
C++ prgms io file unit 7
C++ prgms io file unit 7C++ prgms io file unit 7
C++ prgms io file unit 7
 
Workshop programs
Workshop programsWorkshop programs
Workshop programs
 
MessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization formatMessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization format
 
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume LaforgeGroovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
 
Transmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less painTransmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less pain
 
Next Generation Language Go
Next Generation Language GoNext Generation Language Go
Next Generation Language Go
 
Python for Mac Admins
Python for Mac AdminsPython for Mac Admins
Python for Mac Admins
 
Clojure made really really simple
Clojure made really really simpleClojure made really really simple
Clojure made really really simple
 

En vedette

Vertical Roller Mill Gearbox Reduction Ratio Calculations
Vertical Roller Mill Gearbox Reduction Ratio CalculationsVertical Roller Mill Gearbox Reduction Ratio Calculations
Vertical Roller Mill Gearbox Reduction Ratio CalculationsSyed Fahad Ahmed
 
Hydraulic system vertical roller mill operation
Hydraulic system vertical roller mill operationHydraulic system vertical roller mill operation
Hydraulic system vertical roller mill operationlinxiaomo
 
Clinker cooler's efficiency
Clinker cooler's efficiencyClinker cooler's efficiency
Clinker cooler's efficiencyEmad Sabri
 
Red river in clinker cooler
Red river in clinker  coolerRed river in clinker  cooler
Red river in clinker coolerpradeepdeepi
 
Vertical raw mill pradeep kumar
Vertical raw mill pradeep kumarVertical raw mill pradeep kumar
Vertical raw mill pradeep kumarpradeepdeepi
 

En vedette (7)

Vertical Roller Mill Gearbox Reduction Ratio Calculations
Vertical Roller Mill Gearbox Reduction Ratio CalculationsVertical Roller Mill Gearbox Reduction Ratio Calculations
Vertical Roller Mill Gearbox Reduction Ratio Calculations
 
Hydraulic system vertical roller mill operation
Hydraulic system vertical roller mill operationHydraulic system vertical roller mill operation
Hydraulic system vertical roller mill operation
 
Clinker cooler's efficiency
Clinker cooler's efficiencyClinker cooler's efficiency
Clinker cooler's efficiency
 
Bag filters
Bag filtersBag filters
Bag filters
 
Red river in clinker cooler
Red river in clinker  coolerRed river in clinker  cooler
Red river in clinker cooler
 
VRM
VRMVRM
VRM
 
Vertical raw mill pradeep kumar
Vertical raw mill pradeep kumarVertical raw mill pradeep kumar
Vertical raw mill pradeep kumar
 

Similaire à File. Java

Active Software Documentation using Soul and IntensiVE
Active Software Documentation using Soul and IntensiVEActive Software Documentation using Soul and IntensiVE
Active Software Documentation using Soul and IntensiVEkim.mens
 
Lombokの紹介
Lombokの紹介Lombokの紹介
Lombokの紹介onozaty
 
import required package file import java.io.File; The Filed.pdf
 import required package file import java.io.File; The Filed.pdf import required package file import java.io.File; The Filed.pdf
import required package file import java.io.File; The Filed.pdfanandinternational01
 
Know how to redirect input and output- and know how to append to an ex.docx
Know how to redirect input and output- and know how to append to an ex.docxKnow how to redirect input and output- and know how to append to an ex.docx
Know how to redirect input and output- and know how to append to an ex.docxwkelli
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartGabriele Lana
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C ProgrammingRavindraSalunke3
 
Various types of File Operations in Java
Various types of  File Operations in JavaVarious types of  File Operations in Java
Various types of File Operations in JavaRanjithaM32
 
Module 03 File Handling in C
Module 03 File Handling in CModule 03 File Handling in C
Module 03 File Handling in CTushar B Kute
 
Session 23 - JDBC
Session 23 - JDBCSession 23 - JDBC
Session 23 - JDBCPawanMM
 
Application-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta LanguageApplication-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta LanguageESUG
 
Files in c
Files in cFiles in c
Files in cTanujaA3
 
Migrating existing Projects to Wonder
Migrating existing Projects to WonderMigrating existing Projects to Wonder
Migrating existing Projects to WonderWO Community
 

Similaire à File. Java (20)

Active Software Documentation using Soul and IntensiVE
Active Software Documentation using Soul and IntensiVEActive Software Documentation using Soul and IntensiVE
Active Software Documentation using Soul and IntensiVE
 
DIWE - File handling with PHP
DIWE - File handling with PHPDIWE - File handling with PHP
DIWE - File handling with PHP
 
From Java to Python
From Java to PythonFrom Java to Python
From Java to Python
 
Lombokの紹介
Lombokの紹介Lombokの紹介
Lombokの紹介
 
import required package file import java.io.File; The Filed.pdf
 import required package file import java.io.File; The Filed.pdf import required package file import java.io.File; The Filed.pdf
import required package file import java.io.File; The Filed.pdf
 
Java Week4(A) Notepad
Java Week4(A)   NotepadJava Week4(A)   Notepad
Java Week4(A) Notepad
 
Know how to redirect input and output- and know how to append to an ex.docx
Know how to redirect input and output- and know how to append to an ex.docxKnow how to redirect input and output- and know how to append to an ex.docx
Know how to redirect input and output- and know how to append to an ex.docx
 
My History
My HistoryMy History
My History
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C Programming
 
Various types of File Operations in Java
Various types of  File Operations in JavaVarious types of  File Operations in Java
Various types of File Operations in Java
 
History
HistoryHistory
History
 
Module 03 File Handling in C
Module 03 File Handling in CModule 03 File Handling in C
Module 03 File Handling in C
 
Session 23 - JDBC
Session 23 - JDBCSession 23 - JDBC
Session 23 - JDBC
 
Oop lecture9 12
Oop lecture9 12Oop lecture9 12
Oop lecture9 12
 
Chapter 5 Class File
Chapter 5 Class FileChapter 5 Class File
Chapter 5 Class File
 
Application-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta LanguageApplication-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta Language
 
files.pptx
files.pptxfiles.pptx
files.pptx
 
Files in c
Files in cFiles in c
Files in c
 
Migrating existing Projects to Wonder
Migrating existing Projects to WonderMigrating existing Projects to Wonder
Migrating existing Projects to Wonder
 

Plus de Alexey Bovanenko

Plus de Alexey Bovanenko (20)

Python sqlite3
Python sqlite3Python sqlite3
Python sqlite3
 
Python. re
Python. rePython. re
Python. re
 
python dict
python dictpython dict
python dict
 
Python. Строки
Python. СтрокиPython. Строки
Python. Строки
 
Python. Введение
Python. ВведениеPython. Введение
Python. Введение
 
Nio java
Nio javaNio java
Nio java
 
Конвертация строковых данных в числовые
Конвертация строковых данных в числовыеКонвертация строковых данных в числовые
Конвертация строковых данных в числовые
 
Assert c
Assert cAssert c
Assert c
 
Обработка символов в языке C
Обработка символов в языке CОбработка символов в языке C
Обработка символов в языке C
 
System c
System cSystem c
System c
 
Javascript functions
Javascript functionsJavascript functions
Javascript functions
 
Javascript String object
Javascript String objectJavascript String object
Javascript String object
 
Конструктор копирования
Конструктор копированияКонструктор копирования
Конструктор копирования
 
Tempale Intro
Tempale IntroTempale Intro
Tempale Intro
 
transaction. php
transaction. phptransaction. php
transaction. php
 
cookie. support by php
cookie. support by phpcookie. support by php
cookie. support by php
 
php sessions
php sessionsphp sessions
php sessions
 
Java IO. Streams
Java IO. StreamsJava IO. Streams
Java IO. Streams
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Classes: Number, String, StringBuffer, StringBuilder
Classes: Number, String, StringBuffer, StringBuilderClasses: Number, String, StringBuffer, StringBuilder
Classes: Number, String, StringBuffer, StringBuilder
 

Dernier

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 

Dernier (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 

File. Java

  • 2. File ● public static final char separatorChar ● public static final String separator ● public static final char pathSeparatorChar ● public static final String pathSeparator ● public File(String pathname) ● public File(String parent, String child) ● public File(File parent, String child) ● public File(URI uri) ● public String getName() ● public String getParent() ● public File getParentFile() ● public String getPath() ● public boolean isAbsolute() ● public String getAbsolutePath() ● public File getAbsoluteFile() ● public String getCanonicalPath() throws IOException ● public File getCanonicalFile() throws IOException
  • 3. File (продолжение) ● public boolean canRead() ● public boolean canWrite() ● public boolean exists() ● public boolean isDirectory() ● public boolean isFile() ● public boolean isHidden() ● public long lastModified() ● public long length() ● public boolean createNewFile() throws IOException ● public boolean delete() ● public String[] list() ● public String[] list(FilenameFilter filter) ● public File[] listFiles() ● public File[] listFiles(FilenameFilter filter) ● public File[] listFiles(FileFilter filter) ● public boolean mkdir() ● public boolean mkdirs() ● public boolean renameTo(File dest)
  • 4. File (продолжение) ● public boolean setReadOnly() ● public boolean setWritable(boolean writable, boolean ownerOnly) ● public boolean setWritable(boolean writable) ● public boolean setReadable(boolean readable, boolean ownerOnly) ● public boolean setReadable(boolean readable) ● public boolean setExecutable(boolean executable, boolean ownerOnly) ● public boolean setExecutable(boolean executable) ● public boolean canExecute() ● public long getTotalSpace() ● public long getFreeSpace() ● public long getUsableSpace() ● public static File createTempFile(String prefix, String suffix, File directory) ● public static File createTempFile(String prefix, String suffix) throws IOException
  • 5. Пример использования ● private File f; private Date d; private File f1; public FileTestClass(String name, String name2) { f1=new File(name); d=new Date(f1.lastModified()); f=new File(name2); } public String[] outAllFiles() { File[] fs=f.listFiles(new MyFilter(d)); String[] ss=new String[fs.length]; for(int i=0;i<fs.length;++i) ss[i]=fs[i].getPath(); return ss; }
  • 6. Интерфейс FileFilter ● public interface FileFilter{ boolean accept(File pathname); }
  • 7. Пример использования ● public class MyFilter implements FileFilter{ private Date date; public MyFilter(Date date) { this.date=date; } public boolean accept(File pathname) { Date date1 = new Date(pathname.lastModified()); return (date.getTime()>=date1.getTime()); } }
  • 8. Интерфейс FilanameFilter ● interface FilenameFilter { boolean accept(File dir, String name); }
  • 9. Работа со временем ● class Date ● public Date(long date) ● class GregorianCalendar ● public GregorianCalendar(int year, int month, int dayOfMonth, int hourOfDay, int minute, int second) ● public final Date getTime() ● public final void setTime(Date date)
  • 10. Конец Вопросы e-mail: a.bovanenko@gmail.com