The course is part of this learning path
In this course, we'll learn about the Java Input/Output subject.
- API and Java I/O
- OutputStream Class
- InputStream Class
- Reader Class
- Writer Class
- Serialization, Deserialization, and Non-Serializable objects
- Anyone looking to get Oracle Java Certification
- Those who want to learn the Java Programming language from scratch
- Java developers who want to increase their knowledge
- Beginners with no previous coding experience in Java programming
- Those who want to learn tips and tricks in Oracle Certified Associate – Java SE 8 Programmer certification exams
- No prior knowledge is required about the Java programming language
- Basic computer knowledge
Hi there. In this lesson, we'll talk about API and Java I/O concepts. Let's start with the concept of API. API stands for Application Programming Interface. Its purpose is a software that enables applications developed with their own data and working principles to interact with each other. An application receives information and functions that are not in its own body. Thanks to the API included in its components from the application, which is the source of information and functions, and presents it to the user. In this way, developers do not need to make new programming. It's also practical and fast for users. We can explain this with a simple example. For example, you went to a restaurant and you're going out to eat.
Instead of going to the restaurant's kitchen to eat, you look at the menu and choose the food you want, and then you send your order to the kitchen through the waiter. Your meal is prepared in the kitchen and then brought to you by the waiter. Here, you can think of API as a waiter. The waiter delivers the order for you to the kitchen and brings your food from the kitchen. You don't care about what's going on in the kitchen or you can't go to the kitchen and cook your own food. The API provides this convenience to the programmer. Our applications communicate with other applications through API, which makes sending and receiving data very easy. So, why did we mention the concept of API? Because in this section, we will learn Java input and output operations, and we will use the Java input/output stream API in this process. So, what is the Stream
API? The Stream API was introduced in Java 8. Its main use is to manipulate collections of objects. A stream is actually an array of objects that support various methods that can be piped into a pipeline to produce the desired result. First of all, we can say that stream is not a data structure. Instead, it takes input from collections, arrays, or I/O channels. Streams do not change the original data structure, only provide the result according to pipeline methods. In Java, streams are the sequence of data that are read from the source and written to the destination. I think the API concept is understood.
Now let's talk about the concept of Java I/O. It stands for I/O, Input/Output. In Java, we can receive data from the user with input and output operations, and we can present some data to them. In addition, thanks to Java I/O, we can easily perform file operations. For example, creating a file on the device, writing data into this file, or deleting and reading the data there is the subject of Java I/O. In Java, we perform the input and output operations on our files with the logic of stream. Stream acts as a bridge between the data on our program and the file. In other words, it's kind of a vein system between our program and the file. When we want to transfer data in our project, two options appear before us.
The first is character-based, and the other is byte-based transfer options. When we want to perform character-based data transfer, it carries our data in character. This mode of transport has unicode support, so it supports many alphabets. The character stream is used to read and write a single character of data. All the other character stream classes are derived from base abstract classes, reader and writer. Byte-based transfer operations are carried out in the form of character ensembles. This transfer method is more efficient than character-based transfer. The byte stream is used to read and write a single byte, 8 bits of data. All byte stream classes are derived from base abstract classes called input stream and output stream. Yes, we briefly talked about API and Java I/O concepts. Let's take a short break here. See you in the next lesson.
OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.