Java里Stream (byte 流)的主要类
2010-06-22 09:06:41
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.
The subclasses include:
BufferedInputStream
BufferedOutputStream
ByteArrayInputStream
ByteArrayOutputStream
DataInputStream
DataOutputStream
FileInputStream
FileOutputStream
FilterInputStream
FilterOutputStream
ObjectInputStream
ObjectOutputStream
PipedInputStream
PipedOutputStream
PrintStream
PushbackInputStream
SequenceInputStream
The java.util.zip package contains four input stream classes that read data in compressed format and return it in uncompressed format and four output stream classes that read data in uncompressed format and write in compressed format. These will be discussed in Chapter 10.
CheckedInputStream
CheckedOutputStream
DeflaterOutputStream
GZIPInputStream
GZIPOutputStream
InflaterInputStream
ZipInputStream
ZipOutputStream
The java.util.jar package includes two stream classes for reading files from JAR archives. These will be discussed in Chapter 11.
JarInputStream
JarOutputStream
The java.security package includes a couple of stream classes used for calculating message digests:
DigestInputStream
DigestOutputStream
The Java Cryptography Extension (JCE) adds two classes for encryption and decryption:
CipherInputStream
CipherOutputStream
These four streams will be discussed in Chapter 12.
Finally, a few random stream classes are hiding inside the sun packagesfor example, sun.net.TelnetInputStream and sun.net.TelnetOutputStream. However, these are deliberately hidden from you and are generally presented as instances of java.io.InputStream or java.io.OutputStream only.
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.
The subclasses include:
BufferedInputStream
BufferedOutputStream
ByteArrayInputStream
ByteArrayOutputStream
DataInputStream
DataOutputStream
FileInputStream
FileOutputStream
FilterInputStream
FilterOutputStream
ObjectInputStream
ObjectOutputStream
PipedInputStream
PipedOutputStream
PrintStream
PushbackInputStream
SequenceInputStream
The java.util.zip package contains four input stream classes that read data in compressed format and return it in uncompressed format and four output stream classes that read data in uncompressed format and write in compressed format. These will be discussed in Chapter 10.
CheckedInputStream
CheckedOutputStream
DeflaterOutputStream
GZIPInputStream
GZIPOutputStream
InflaterInputStream
ZipInputStream
ZipOutputStream
The java.util.jar package includes two stream classes for reading files from JAR archives. These will be discussed in Chapter 11.
JarInputStream
JarOutputStream
The java.security package includes a couple of stream classes used for calculating message digests:
DigestInputStream
DigestOutputStream
The Java Cryptography Extension (JCE) adds two classes for encryption and decryption:
CipherInputStream
CipherOutputStream
These four streams will be discussed in Chapter 12.
Finally, a few random stream classes are hiding inside the sun packagesfor example, sun.net.TelnetInputStream and sun.net.TelnetOutputStream. However, these are deliberately hidden from you and are generally presented as instances of java.io.InputStream or java.io.OutputStream only.
相关推荐
在Java中,Stream主要用于处理大量数据,它可以与集合、I/O通道等多种数据源交互,提供了丰富的操作接口来过滤、映射、聚合等。Stream API首次在Java 8中引入,极大地提升了代码的简洁性和可读性。 Java中的Stream...
Java的IO流是Java编程语言中的重要组成部分,它主要用于数据的输入和输出操作。在Java中,IO流被设计为处理任何类型的数据,包括字符、字节甚至对象。本练习旨在帮助初学者理解和掌握Java IO流的基础知识。 一、IO...
在Java编程中,字节流(Byte Stream)是处理数据的基本方式,特别是在处理二进制数据,如图片、音频或视频文件时。本教程将详细讲解如何使用Java实现字节流来转换和处理图片。 首先,我们需要理解字节流的概念。在...
在Java编程语言中,字节流(Byte Stream)和字符流(Character Stream)是处理输入输出数据的两种基本方式。字节流主要用于处理任何类型的二进制数据,如图片、音频、视频等,而字符流则专为处理基于Unicode编码的...
Java IO流分为两大类:字符流(Character Stream)和字节流(Byte Stream)。字符流处理单个字符,而字节流处理8位的字节序列。它们又可以进一步细分为输入流(InputStream/Reader)和输出流(OutputStream/Writer)...
在Java编程语言中,字节流(Byte Stream)是I/O操作的基础,它处理的是单个字节的数据。本文将详细解析"ByteIO_java_字节流_"这个主题,主要基于提供的`ByteIO.java`源代码文件,探讨字节流的基本概念、分类、常用类...
Java的I/O系统主要分为两大类:字节流(Byte Stream)和字符流(Character Stream)。字节流处理的是8位的字节数据,适用于处理任何类型的数据,包括图像、音频等二进制文件;而字符流则处理16位的Unicode字符,适合...
Java中主要分为两种流:输入流(Input Stream)和输出流(Output Stream)。 ##### 2. InputStream 类 - **2.1 read 方法** `InputStream`类中的`read`方法用于从指定的输入流读取数据,主要有三种形式: 1. `int ...
在Java API中,I/O流被组织为一系列类和接口,主要位于`java.io`包。在JDK 1.0中引入了字节流(byte stream),JDK 1.1则添加了字符流(char stream)。字节流处理数据单位为字节,而字符流处理的是Unicode字符,...
不过,通常的处理流程是将这些二进制数据读取到内存中,形成一个字节数组流(byte[]),然后可以利用各种库如nodejs中的Buffer类或Java中的ByteBuffer类来对这些数据进行读取、写入和转换。 在技术实现上,如果我们...
在Java的I/O包中,根据处理数据的不同类型,可以将流分为两大类:字节流和字符流。字节流主要包括`InputStream`和`OutputStream`,而字符流则有`Reader`和`Writer`。每一类都有其特定的用途和子类。 - **字节流** ...
在Java中,输入输出流分为两大类:字节流(Byte Stream)和字符流(Character Stream)。字节流处理单个字节的数据,而字符流处理Unicode字符。Java的I/O流体系由四个主要接口构成:InputStream和OutputStream处理...
在Java中,我们可以通过`BitSet`类来处理比特位,并用循环和位操作实现LFSR。 ```java public class LFSR { private BitSet register; private int feedback; public LFSR(int seed) { register = new BitSet...
输入流主要用于读取数据,Java提供了一系列的类来支持不同的输入操作。主要分为以下几类: 1. **字节流**:字节流处理单个字节的数据,包括`InputStream`抽象类,它是所有字节输入流的基类。常见的子类有`...
输入输出流类——字节流 在 Java 中,输入输出流可以分为两种:字节流和字符流。字节流是以 byte 为单位的流,主要用于处理二进制文件,如图片、音频等。Java 中的字节流包括 InputStream 和 OutputStream 两个接口...
在Java编程中,字节流(Byte Stream)是处理数据的一种基本方式,它适用于任何类型的数据,包括文本、图片、音频等。字节流主要分为输入流和输出流,其中InputStream类是所有字节输入流的基类,而OutputStream类则是...
2. 按数据类型:字节流(Byte Stream)、字符流(Character Stream) 3. 按功能:节点流(直接操作数据源,如FileInputStream)和处理流(不直接操作数据源,而是包裹其他流,如BufferedInputStream) 四、常用类 1...
它利用了Java提供的缓冲流类`BufferedInputStream`和`BufferedOutputStream`来自动管理缓冲区,使得程序员无需手动管理缓冲区的细节。 ```java import java.io.*; public class BufferStreamCopy { public static...
Java流分为两大类:字节流(Byte Stream)和字符流(Character Stream)。字节流处理原始的8位字节数据,如图片或音频文件,而字符流处理Unicode字符序列,如文本文件。 - **字节流**:主要包括`InputStream`和`...