Class LinkedDataReader
java.lang.Object
cool.scx.io.LinkedDataReader
- All Implemented Interfaces:
DataReader
LinkedDataReader
- Version:
- 0.0.1
- Author:
- scx567888
-
Field Summary
Fields inherited from interface cool.scx.io.DataReader
EMPTY_BYTES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintindexOf(byte[] pattern, int max) 查找 指定字节数组 第一次出现的 index (指针不会移动)intindexOf(byte b, int max) 查找 指定字节 第一次出现的 index (指针不会移动)bytepeek()向 dataConsumer 写入指定长度字节 (指针不会移动) 当没有更多的数据时会抛出异常byte[]peek(int maxLength) 读取指定长度字节 (指针不会移动) 当没有更多的数据时会抛出异常voidpeek(DataConsumer dataConsumer, int maxLength) 向 outputStream 写入指定长度字节 (指针不会移动) 当没有更多的数据时会抛出异常byteread()读取单个字节 (指针会移动) 当没有更多的数据时会抛出异常byte[]read(int maxLength) 读取字节 (指针会移动) 当没有更多的数据时会抛出异常voidread(DataConsumer dataConsumer, int maxLength) 向 dataConsumer 写入指定长度字节 (指针会移动) 当没有更多的数据时会抛出异常voidskip(int length) 向后移动指定字节
-
Constructor Details
-
LinkedDataReader
-
-
Method Details
-
read
Description copied from interface:DataReader读取单个字节 (指针会移动) 当没有更多的数据时会抛出异常- Specified by:
readin interfaceDataReader- Returns:
- byte
- Throws:
NoMoreDataException- 没有更多数据时抛出
-
read
Description copied from interface:DataReader读取字节 (指针会移动) 当没有更多的数据时会抛出异常- Specified by:
readin interfaceDataReader- Parameters:
maxLength- 最大长度- Returns:
- bytes
- Throws:
NoMoreDataException- 没有更多数据时抛出
-
read
Description copied from interface:DataReader向 dataConsumer 写入指定长度字节 (指针会移动) 当没有更多的数据时会抛出异常- Specified by:
readin interfaceDataReader- Parameters:
maxLength- 最大长度- Throws:
NoMoreDataException- 没有更多数据时抛出
-
peek
Description copied from interface:DataReader向 dataConsumer 写入指定长度字节 (指针不会移动) 当没有更多的数据时会抛出异常- Specified by:
peekin interfaceDataReader- Returns:
- byte
- Throws:
NoMoreDataException- 没有更多数据时抛出
-
peek
Description copied from interface:DataReader读取指定长度字节 (指针不会移动) 当没有更多的数据时会抛出异常- Specified by:
peekin interfaceDataReader- Parameters:
maxLength- 最大长度- Returns:
- byte
- Throws:
NoMoreDataException- 没有更多数据时抛出
-
peek
Description copied from interface:DataReader向 outputStream 写入指定长度字节 (指针不会移动) 当没有更多的数据时会抛出异常- Specified by:
peekin interfaceDataReader- Parameters:
maxLength- 最大长度- Throws:
NoMoreDataException- 没有更多数据时抛出
-
indexOf
Description copied from interface:DataReader查找 指定字节 第一次出现的 index (指针不会移动)- Specified by:
indexOfin interfaceDataReader- Parameters:
b- 指定字节max- 最大长度- Returns:
- index 或者 -1 (未找到)
- Throws:
NoMatchFoundException- 没有匹配时抛出NoMoreDataException
-
indexOf
Description copied from interface:DataReader查找 指定字节数组 第一次出现的 index (指针不会移动)- Specified by:
indexOfin interfaceDataReader- Parameters:
pattern- 指定字节数组max- 最大长度- Returns:
- index 或者 -1 (未找到)
- Throws:
NoMatchFoundException- 没有匹配时抛出NoMoreDataException
-
skip
Description copied from interface:DataReader向后移动指定字节- Specified by:
skipin interfaceDataReader- Parameters:
length- 移动长度- Throws:
NoMoreDataException
-