📜  Java.io.StringBufferInputStream类

📅  最后修改于: 2020-11-15 02:52:52             🧑  作者: Mango


介绍

Java.io.StringBufferInputStream类允许应用程序创建输入流,在该输入流中,读取的字节由字符串的内容提供。应用程序还可以使用ByteArrayInputStream从字节数组中读取字节。此类仅使用字符串中每个字符的低八位。

此类已被Oracle弃用,不再使用。

类声明

以下是Java.io.StringBufferInputStream类的声明-

public class StringBufferInputStream
   extends InputStream

领域

以下是Java.io.StringBufferInputStream类的字段-

  • protected String buffer-这是从中读取字节的字符串。

  • protected int count-这是输入流缓冲区中有效字符的数量。

  • protected int pos-这是要从输入流缓冲区读取的下一个字符的索引。

类的构造函数

Sr.No. Constructor & Description
1

StringBufferInputStream(String s)

This creates a string input stream to read data from the specified string.

类方法

Sr.No. Method & Description
1

int available()

This method returns the number of bytes that can be read from the input stream without blocking.

2

int read()

This method reads the next byte of data from this input stream.

3

int read(byte[] b, int off, int len)

This method reads up to len bytes of data from this input stream into an array of bytes.

4

void reset()

This method resets the input stream to begin reading from the first character of this input stream’s underlying buffer.

5

long skip(long n)

This method skips n bytes of input from this input stream.

方法继承

此类从以下类继承方法-

  • Java.io.InputStreams
  • Java对象