SlideShare une entreprise Scribd logo
1  sur  18
Featuring JDK 7 NIO 2 @edgedalmacio about.me/edgedalmacio haybol.ph
THANK YOU
java.io.File Many methods didn't throw exceptions when they failed. Rename method didn't work consistently across platforms. There was no real support for symbolic links. Limited support for metadata, such as file permissions, file owner, and other security attributes. Accessing file metadata was inefficient. Many of the File methods didn't scale. It was not possible to write reliable code that could recursively walk a file tree and respond appropriately if there were circular symbolic links.
java.nio.file.Path
Creating a Path import java.nio.file.Paths; Path p1 = Paths.get("/tmp/foo");  Path p2 = Paths.get(args[0]);  Path p3 = Paths.get( URI.create("file:///Users/joe/FileTest.java"));
Checking File Accessibility import java.nio.file.Files; Path file = ...;  booleanisRegularExecutableFile 	= Files.isRegularFile(file)  	& Files.isReadable(file)  	& Files.isExecutable(file);
Checking Whether Two Paths Locate the Same File Path p1 = ...;  Path p2 = ...;  if (Files.isSameFile(p1, p2)) {  //Logic when the paths locate the same file  }
Deleting a File or Directory try { Files.delete(path); }  catch  (NoSuchFileException) … catch (DirectoryNotEmptyException) … catch  (IOException) …
Copying a File or Directory import static java.nio.file.StandardCopyOption.*;  …  Files.copy(source, target, REPLACE_EXISTING, COPY_ATTRIBUTES, NOFOLLOW_LINKS);
Managing Metadata java.nio.file.Files size isDirectory isRegularFile isSymbolicLink isHidden get/setLastModifiedTime get/setOwner get/setPosixFilePermissions get/setAttribute
Reading, Writing and Creating Files
Reading a File by Using Buffered Stream I/O BufferedReaderreader = Files.newBufferedReader 		(file, charset) reader.readLine();
Methods for Unbuffered Streams and Interoperable with java.io APIs InputStreamin = Files.newInputStream(file);  BufferedReaderreader =  new BufferedReader( 	new InputStreamReader(in)); reader.readLine();
Interoperability With Legacy Code java.io.Filefile =  	new File(pathname); java.nio.file.Path path =  file.toPath();
java.nio.file Path methods for manipulating a path. Files methods for file operations, such as moving, copy, deleting, and also methods for retrieving and setting file attributes. FileSystem methods for obtaining information about the file system.
About Orange & Bronze Software Labs ,[object Object]
Consulting, outsourcing, and offshore product development services using Open Source technologies, with a specialization in the Spring and Grails frameworks
Enterprise solutions with Google enterprise products and business intelligence solutions with the Pentaho BI Suite

Contenu connexe

En vedette

Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Martijn Verburg
 
Agile Software Development - Making Programming Fun Again
Agile Software Development - Making Programming Fun AgainAgile Software Development - Making Programming Fun Again
Agile Software Development - Making Programming Fun AgainOrange and Bronze Software Labs
 
Agile Executive Forum: Agile Development Practices at Sabre
Agile Executive  Forum: Agile Development Practices at SabreAgile Executive  Forum: Agile Development Practices at Sabre
Agile Executive Forum: Agile Development Practices at SabreOrange and Bronze Software Labs
 
Introducing the Java NIO.2
Introducing the Java NIO.2Introducing the Java NIO.2
Introducing the Java NIO.2Fadel Adoe
 
Introduction of netty
Introduction of nettyIntroduction of netty
Introduction of nettyBing Luo
 
Sip Fundamentals and Prospects Tutorial - VoiceCon Orlando 2010
Sip Fundamentals and Prospects Tutorial - VoiceCon Orlando 2010Sip Fundamentals and Prospects Tutorial - VoiceCon Orlando 2010
Sip Fundamentals and Prospects Tutorial - VoiceCon Orlando 2010Voxeo Corp
 

En vedette (19)

Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2
 
Nio2
Nio2Nio2
Nio2
 
Technology trends and the skills you should learn
Technology trends and the skills you should learnTechnology trends and the skills you should learn
Technology trends and the skills you should learn
 
Agile Executive Forum: Welcoming Remarks
Agile Executive  Forum: Welcoming RemarksAgile Executive  Forum: Welcoming Remarks
Agile Executive Forum: Welcoming Remarks
 
Why Most IT Projects Fail
Why Most IT Projects FailWhy Most IT Projects Fail
Why Most IT Projects Fail
 
Are you Agile enough?
Are you Agile enough?Are you Agile enough?
Are you Agile enough?
 
Google Apps for Business with Archiving & Discovery
Google Apps for Business with Archiving & Discovery Google Apps for Business with Archiving & Discovery
Google Apps for Business with Archiving & Discovery
 
Agile Software Development - Making Programming Fun Again
Agile Software Development - Making Programming Fun AgainAgile Software Development - Making Programming Fun Again
Agile Software Development - Making Programming Fun Again
 
What is agile
What is agileWhat is agile
What is agile
 
Agile Executive Forum: Agile Development Practices at Sabre
Agile Executive  Forum: Agile Development Practices at SabreAgile Executive  Forum: Agile Development Practices at Sabre
Agile Executive Forum: Agile Development Practices at Sabre
 
Agile Executive Forum: Agile and Outsourcing
Agile Executive Forum: Agile and OutsourcingAgile Executive Forum: Agile and Outsourcing
Agile Executive Forum: Agile and Outsourcing
 
Lesser Known Opportunities in Technology
Lesser Known Opportunities in TechnologyLesser Known Opportunities in Technology
Lesser Known Opportunities in Technology
 
Agile Executive Forum: O&B Adoption Story
Agile Executive Forum: O&B Adoption StoryAgile Executive Forum: O&B Adoption Story
Agile Executive Forum: O&B Adoption Story
 
Introducing the Java NIO.2
Introducing the Java NIO.2Introducing the Java NIO.2
Introducing the Java NIO.2
 
Java NIO.2
Java NIO.2Java NIO.2
Java NIO.2
 
NIO and NIO2
NIO and NIO2NIO and NIO2
NIO and NIO2
 
Introduction of netty
Introduction of nettyIntroduction of netty
Introduction of netty
 
Sip Fundamentals and Prospects Tutorial - VoiceCon Orlando 2010
Sip Fundamentals and Prospects Tutorial - VoiceCon Orlando 2010Sip Fundamentals and Prospects Tutorial - VoiceCon Orlando 2010
Sip Fundamentals and Prospects Tutorial - VoiceCon Orlando 2010
 

Similaire à Featuring JDK 7 Nio 2

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
 
File Handling in Java Oop presentation
File Handling in Java Oop presentationFile Handling in Java Oop presentation
File Handling in Java Oop presentationAzeemaj101
 
file-transfer-using-tcp.pdf
file-transfer-using-tcp.pdffile-transfer-using-tcp.pdf
file-transfer-using-tcp.pdfJayaprasanna4
 
Secure Code Warrior - Local file inclusion
Secure Code Warrior - Local file inclusionSecure Code Warrior - Local file inclusion
Secure Code Warrior - Local file inclusionSecure Code Warrior
 
WhatsNewNIO2.pdf
WhatsNewNIO2.pdfWhatsNewNIO2.pdf
WhatsNewNIO2.pdfMohit Kumar
 
NIO.2, the I/O API for the future
NIO.2, the I/O API for the futureNIO.2, the I/O API for the future
NIO.2, the I/O API for the futureMasoud Kalali
 
Clean Sweep FileSystem - Java NIO 2
Clean Sweep FileSystem - Java NIO 2Clean Sweep FileSystem - Java NIO 2
Clean Sweep FileSystem - Java NIO 2javagroup2006
 
7.Canon & Dt
7.Canon & Dt7.Canon & Dt
7.Canon & Dtphanleson
 
what are python basics.pptx.Join Python training in Chandigarh
what are python basics.pptx.Join Python training in Chandigarhwhat are python basics.pptx.Join Python training in Chandigarh
what are python basics.pptx.Join Python training in Chandigarhasmeerana605
 
Dan Crowley - Jack Of All Formats
Dan Crowley - Jack Of All FormatsDan Crowley - Jack Of All Formats
Dan Crowley - Jack Of All FormatsSource Conference
 
java.io - streams and files
java.io - streams and filesjava.io - streams and files
java.io - streams and filesMarcello Thiry
 
Saveface - Save your Facebook content as RDF data
Saveface - Save your Facebook content as RDF dataSaveface - Save your Facebook content as RDF data
Saveface - Save your Facebook content as RDF dataFuming Shih
 

Similaire à Featuring JDK 7 Nio 2 (20)

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
 
FileHandling.docx
FileHandling.docxFileHandling.docx
FileHandling.docx
 
File Handling in Java Oop presentation
File Handling in Java Oop presentationFile Handling in Java Oop presentation
File Handling in Java Oop presentation
 
JAVA
JAVAJAVA
JAVA
 
file-transfer-using-tcp.pdf
file-transfer-using-tcp.pdffile-transfer-using-tcp.pdf
file-transfer-using-tcp.pdf
 
Secure Code Warrior - Local file inclusion
Secure Code Warrior - Local file inclusionSecure Code Warrior - Local file inclusion
Secure Code Warrior - Local file inclusion
 
WhatsNewNIO2.pdf
WhatsNewNIO2.pdfWhatsNewNIO2.pdf
WhatsNewNIO2.pdf
 
NIO.2, the I/O API for the future
NIO.2, the I/O API for the futureNIO.2, the I/O API for the future
NIO.2, the I/O API for the future
 
Clean Sweep FileSystem - Java NIO 2
Clean Sweep FileSystem - Java NIO 2Clean Sweep FileSystem - Java NIO 2
Clean Sweep FileSystem - Java NIO 2
 
Chapter 5 Class File
Chapter 5 Class FileChapter 5 Class File
Chapter 5 Class File
 
7.Canon & Dt
7.Canon & Dt7.Canon & Dt
7.Canon & Dt
 
what are python basics.pptx.Join Python training in Chandigarh
what are python basics.pptx.Join Python training in Chandigarhwhat are python basics.pptx.Join Python training in Chandigarh
what are python basics.pptx.Join Python training in Chandigarh
 
Dan Crowley - Jack Of All Formats
Dan Crowley - Jack Of All FormatsDan Crowley - Jack Of All Formats
Dan Crowley - Jack Of All Formats
 
java.io - streams and files
java.io - streams and filesjava.io - streams and files
java.io - streams and files
 
Java Week4(A) Notepad
Java Week4(A)   NotepadJava Week4(A)   Notepad
Java Week4(A) Notepad
 
Jstreams
JstreamsJstreams
Jstreams
 
Java se7 features
Java se7 featuresJava se7 features
Java se7 features
 
Saveface - Save your Facebook content as RDF data
Saveface - Save your Facebook content as RDF dataSaveface - Save your Facebook content as RDF data
Saveface - Save your Facebook content as RDF data
 
DIWE - File handling with PHP
DIWE - File handling with PHPDIWE - File handling with PHP
DIWE - File handling with PHP
 
Python, WebRTC and You
Python, WebRTC and YouPython, WebRTC and You
Python, WebRTC and You
 

Dernier

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 

Dernier (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 

Featuring JDK 7 Nio 2

  • 1. Featuring JDK 7 NIO 2 @edgedalmacio about.me/edgedalmacio haybol.ph
  • 3. java.io.File Many methods didn't throw exceptions when they failed. Rename method didn't work consistently across platforms. There was no real support for symbolic links. Limited support for metadata, such as file permissions, file owner, and other security attributes. Accessing file metadata was inefficient. Many of the File methods didn't scale. It was not possible to write reliable code that could recursively walk a file tree and respond appropriately if there were circular symbolic links.
  • 5. Creating a Path import java.nio.file.Paths; Path p1 = Paths.get("/tmp/foo"); Path p2 = Paths.get(args[0]); Path p3 = Paths.get( URI.create("file:///Users/joe/FileTest.java"));
  • 6. Checking File Accessibility import java.nio.file.Files; Path file = ...; booleanisRegularExecutableFile = Files.isRegularFile(file) & Files.isReadable(file) & Files.isExecutable(file);
  • 7. Checking Whether Two Paths Locate the Same File Path p1 = ...; Path p2 = ...; if (Files.isSameFile(p1, p2)) { //Logic when the paths locate the same file }
  • 8. Deleting a File or Directory try { Files.delete(path); } catch (NoSuchFileException) … catch (DirectoryNotEmptyException) … catch (IOException) …
  • 9. Copying a File or Directory import static java.nio.file.StandardCopyOption.*; … Files.copy(source, target, REPLACE_EXISTING, COPY_ATTRIBUTES, NOFOLLOW_LINKS);
  • 10. Managing Metadata java.nio.file.Files size isDirectory isRegularFile isSymbolicLink isHidden get/setLastModifiedTime get/setOwner get/setPosixFilePermissions get/setAttribute
  • 11. Reading, Writing and Creating Files
  • 12. Reading a File by Using Buffered Stream I/O BufferedReaderreader = Files.newBufferedReader (file, charset) reader.readLine();
  • 13. Methods for Unbuffered Streams and Interoperable with java.io APIs InputStreamin = Files.newInputStream(file); BufferedReaderreader = new BufferedReader( new InputStreamReader(in)); reader.readLine();
  • 14. Interoperability With Legacy Code java.io.Filefile = new File(pathname); java.nio.file.Path path = file.toPath();
  • 15. java.nio.file Path methods for manipulating a path. Files methods for file operations, such as moving, copy, deleting, and also methods for retrieving and setting file attributes. FileSystem methods for obtaining information about the file system.
  • 16.
  • 17. Consulting, outsourcing, and offshore product development services using Open Source technologies, with a specialization in the Spring and Grails frameworks
  • 18. Enterprise solutions with Google enterprise products and business intelligence solutions with the Pentaho BI Suite
  • 19. Offers Java, Agile and Android training courseswww.orangeandbronze.com
  • 21. References File I/O (Featuring NIO.2) http://download.oracle.com/javase/tutorial/essential/io/fileio.html More New I/O APIs for the Java Platform http://openjdk.java.net/projects/nio/