Java IO

#Java IO #Part I: Basic I/O
##Chapter 1. Introducing I/O
Input and output, I/O for short, are fundamental to any computer operating system or programming language.For the most part I/O in Java is divided into two types: byte- and number-oriented I/O, which is handled by input and output streams; and character and text I/O, which is handled by readers and writers.
###1.1 What Is a Stream?
A stream is an ordered sequence of bytes of undetermined length. Input streams move bytes of data into a Java program from some generally external source. Output streams move bytes of data from Java to some generally external target. (In special cases streams can also move bytes from one part of a Java program to another.)
####1.1.1 Where Do Streams Come From? The first source of input most programmers encounter is System.in. This is the same thing as stdin in C, generally some sort of console window, probably the one in which the Java program was launched.
####1.1.2 The Stream Classes
Most of the classes that work directly with streams are part of the java.io package. The two main classes are java.io.InputStream and java.io.OutputStream . These are abstract base classes for many different subclasses with more specialized abilities, including: BufferedInputStream BufferedOutputStream ByteArrayInputStream ByteArrayOutputStream DataInputStream DataOutputStream FileInputStream FileOutputStream FilterInputStream FilterOutputStream LineNumberInputStream ObjectInputStream ObjectOutputStream PipedInputStream PipedOutputStream PrintStream PushbackInputStream SequenceInputStream StringBufferInputStream

###1.2 Numeric Data
Input streams read bytes and output streams write bytes. Readers read characters and writers write characters. Therefore, to understand input and output, you first need a solid understanding of how Java deals with bytes, integers, characters, and other primitive data types, and when and why one is converted into another. In many cases Java's behavior is not obvious. ####1.2.1 Integer Data

转载于:https://my.oschina.net/LosersAFC/blog/213256

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值