SlideShare a Scribd company logo
Язык 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

More Related Content

What's hot (14)

PDF
Migrating from drupal to plone with transmogrifier
Clayton Parker
 
DOCX
java copy file program
Glen Pais
 
PDF
Geeks Anonymes - Le langage Go
Geeks Anonymes
 
PDF
Go破壊
Hattori Hideo
 
PDF
Closures for Java
nextlib
 
PDF
File input output in Java
Fiverr
 
PDF
C++ prgms io file unit 7
Ananda Kumar HN
 
PDF
Workshop programs
Kracekumar Ramaraju
 
PPTX
MessagePack - An efficient binary serialization format
Larry Nung
 
PDF
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Guillaume Laforge
 
PDF
Transmogrifier: Migrating to Plone with less pain
Lennart Regebro
 
PPTX
Next Generation Language Go
Yoichiro Shimizu
 
PDF
Python for Mac Admins
Timothy Sutton
 
ODP
Clojure made really really simple
John Stevenson
 
Migrating from drupal to plone with transmogrifier
Clayton Parker
 
java copy file program
Glen Pais
 
Geeks Anonymes - Le langage Go
Geeks Anonymes
 
Go破壊
Hattori Hideo
 
Closures for Java
nextlib
 
File input output in Java
Fiverr
 
C++ prgms io file unit 7
Ananda Kumar HN
 
Workshop programs
Kracekumar Ramaraju
 
MessagePack - An efficient binary serialization format
Larry Nung
 
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Guillaume Laforge
 
Transmogrifier: Migrating to Plone with less pain
Lennart Regebro
 
Next Generation Language Go
Yoichiro Shimizu
 
Python for Mac Admins
Timothy Sutton
 
Clojure made really really simple
John Stevenson
 

Viewers also liked (7)

PDF
Vertical Roller Mill Gearbox Reduction Ratio Calculations
Syed Fahad Ahmed
 
DOCX
Hydraulic system vertical roller mill operation
linxiaomo
 
PPT
Clinker cooler's efficiency
Emad Sabri
 
PDF
Bag filters
Egmont Ottermann
 
PDF
Red river in clinker cooler
pradeepdeepi
 
PPT
VRM
mkpasha
 
PDF
Vertical raw mill pradeep kumar
pradeepdeepi
 
Vertical Roller Mill Gearbox Reduction Ratio Calculations
Syed Fahad Ahmed
 
Hydraulic system vertical roller mill operation
linxiaomo
 
Clinker cooler's efficiency
Emad Sabri
 
Bag filters
Egmont Ottermann
 
Red river in clinker cooler
pradeepdeepi
 
VRM
mkpasha
 
Vertical raw mill pradeep kumar
pradeepdeepi
 
Ad

Similar to File. Java (20)

PDF
Active Software Documentation using Soul and IntensiVE
kim.mens
 
PPSX
DIWE - File handling with PHP
Rasan Samarasinghe
 
PPT
From Java to Python
Alexandre González Rodríguez
 
PDF
Lombokの紹介
onozaty
 
PDF
import required package file import java.io.File; The Filed.pdf
anandinternational01
 
PDF
Java Week4(A) Notepad
Chaitanya Rajkumar Limmala
 
DOCX
Know how to redirect input and output- and know how to append to an ex.docx
wkelli
 
PDF
My History
santosh mishra
 
PDF
Refactoring In Tdd The Missing Part
Gabriele Lana
 
PDF
File Handling in C Programming
RavindraSalunke3
 
PPTX
Various types of File Operations in Java
RanjithaM32
 
PDF
History
santosh mishra
 
PDF
Module 03 File Handling in C
Tushar B Kute
 
PPTX
Session 23 - JDBC
PawanMM
 
PPT
Oop lecture9 12
Shahriar Robbani
 
PPT
Chapter 5 Class File
Khirulnizam Abd Rahman
 
PDF
Application-Specific Models and Pointcuts using a Logic Meta Language
ESUG
 
PPTX
files.pptx
KeerthanaM738437
 
PDF
Files in c
TanujaA3
 
PDF
Migrating existing Projects to Wonder
WO Community
 
Active Software Documentation using Soul and IntensiVE
kim.mens
 
DIWE - File handling with PHP
Rasan Samarasinghe
 
From Java to Python
Alexandre González Rodríguez
 
Lombokの紹介
onozaty
 
import required package file import java.io.File; The Filed.pdf
anandinternational01
 
Java Week4(A) Notepad
Chaitanya Rajkumar Limmala
 
Know how to redirect input and output- and know how to append to an ex.docx
wkelli
 
My History
santosh mishra
 
Refactoring In Tdd The Missing Part
Gabriele Lana
 
File Handling in C Programming
RavindraSalunke3
 
Various types of File Operations in Java
RanjithaM32
 
Module 03 File Handling in C
Tushar B Kute
 
Session 23 - JDBC
PawanMM
 
Oop lecture9 12
Shahriar Robbani
 
Chapter 5 Class File
Khirulnizam Abd Rahman
 
Application-Specific Models and Pointcuts using a Logic Meta Language
ESUG
 
files.pptx
KeerthanaM738437
 
Files in c
TanujaA3
 
Migrating existing Projects to Wonder
WO Community
 
Ad

More from Alexey Bovanenko (20)

PDF
Python sqlite3
Alexey Bovanenko
 
PDF
Python. re
Alexey Bovanenko
 
PDF
python dict
Alexey Bovanenko
 
PDF
Python. Строки
Alexey Bovanenko
 
PDF
Python. Введение
Alexey Bovanenko
 
PPT
Nio java
Alexey Bovanenko
 
PPT
Конвертация строковых данных в числовые
Alexey Bovanenko
 
ODP
Assert c
Alexey Bovanenko
 
PPT
Обработка символов в языке C
Alexey Bovanenko
 
ODP
System c
Alexey Bovanenko
 
PPTX
Javascript functions
Alexey Bovanenko
 
PPTX
Javascript String object
Alexey Bovanenko
 
PDF
Конструктор копирования
Alexey Bovanenko
 
PDF
Tempale Intro
Alexey Bovanenko
 
PDF
transaction. php
Alexey Bovanenko
 
PDF
cookie. support by php
Alexey Bovanenko
 
PDF
php sessions
Alexey Bovanenko
 
ODP
Java IO. Streams
Alexey Bovanenko
 
ODP
Regular Expressions
Alexey Bovanenko
 
ODP
Classes: Number, String, StringBuffer, StringBuilder
Alexey Bovanenko
 
Python sqlite3
Alexey Bovanenko
 
Python. re
Alexey Bovanenko
 
python dict
Alexey Bovanenko
 
Python. Строки
Alexey Bovanenko
 
Python. Введение
Alexey Bovanenko
 
Конвертация строковых данных в числовые
Alexey Bovanenko
 
Обработка символов в языке C
Alexey Bovanenko
 
Javascript functions
Alexey Bovanenko
 
Javascript String object
Alexey Bovanenko
 
Конструктор копирования
Alexey Bovanenko
 
Tempale Intro
Alexey Bovanenko
 
transaction. php
Alexey Bovanenko
 
cookie. support by php
Alexey Bovanenko
 
php sessions
Alexey Bovanenko
 
Java IO. Streams
Alexey Bovanenko
 
Regular Expressions
Alexey Bovanenko
 
Classes: Number, String, StringBuffer, StringBuilder
Alexey Bovanenko
 

Recently uploaded (20)

PDF
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
PDF
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
PPTX
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PDF
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PPTX
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PPTX
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PDF
Vietnam Street Food & QSR Market 2025-1.pdf
ssuserec8cd0
 
PDF
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
PDF
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
PPTX
Different types of inheritance in odoo 18
Celine George
 
PDF
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
PPTX
AIMA UCSC-SV Leadership_in_the_AI_era 20250628 v16.pptx
home
 
PDF
Council of Chalcedon Re-Examined
Smiling Lungs
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
Light Reflection and Refraction- Activities - Class X Science
SONU ACADEMY
 
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
Introduction presentation of the patentbutler tool
MIPLM
 
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
Introduction to Indian Writing in English
Trushali Dodiya
 
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
Vietnam Street Food & QSR Market 2025-1.pdf
ssuserec8cd0
 
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
Different types of inheritance in odoo 18
Celine George
 
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
AIMA UCSC-SV Leadership_in_the_AI_era 20250628 v16.pptx
home
 
Council of Chalcedon Re-Examined
Smiling Lungs
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Light Reflection and Refraction- Activities - Class X Science
SONU ACADEMY
 

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: [email protected]