public class ContinuableRecordInput extends java.lang.Object implements LittleEndianInput
RecordInputStream
that can read primitive data types (short, int, long, etc.) spanned across a
ContinueRecord
boundary.
Most records construct themselves from RecordInputStream
. This class assumes that a ContinueRecord
record break always occurs at the type boundary, however, it is not always so.
short
. The problematic portion of the data is in a Asian Phonetic Settings Block (ExtRst) of a UnicodeString.
RecordInputStream
greedily requests the bytes to be read and stumbles on such files with a "Not enough data (1) to read requested (2) bytes" exception. The ContinuableRecordInput
class circumvents this "type boundary" rule and reads data byte-by-byte rolling over CONTINUE if necessary.
YK: For now (March 2011) this class is only used to read
(可以读取跨越 ContinueRecord 边界的原始数据类型(short、int、long 等)的装饰 RecordInputStream。大多数记录都是从 RecordInputStream 构建的。此类假定 ContinueRecord 记录中断总是发生在类型边界处,但并非总是如此。 Bugzilla 50779 的两个附件表明 CONTINUE 中断可以出现在 unicode 字符的两个字节之间或 short 的两个字节之间。数据的问题部分位于 UnicodeString 的亚洲语音设置块 (ExtRst) 中。 RecordInputStream 贪婪地请求要读取的字节,并以“没有足够的数据 (1) 读取请求的 (2) 字节”异常偶然发现此类文件。 ContinuableRecordInput 类绕过了这个“类型边界”规则,并在必要时逐字节滚动读取数据。 YK:目前(2011 年 3 月)该课程仅用于阅读)blocks of a UnicodeString.
Constructor and Description |
---|
ContinuableRecordInput(RecordInputStream in) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
byte |
readByte() |
double |
readDouble() |
void |
readFully(byte[] buf) |
void |
readFully(byte[] buf, int off, int len) |
int |
readInt() |
long |
readLong() |
void |
readPlain(byte[] buf, int off, int len)
Usually acts the same as
LittleEndianInput.readFully(byte[], int, int) , but for an encrypted stream the raw (unencrypted) data is filled
(通常行为与 LittleEndianInput.readFully(byte[], int, int) 相同,但对于加密流,原始(未加密)数据被填充)
|
short |
readShort() |
int |
readUByte() |
int |
readUShort() |
public ContinuableRecordInput(RecordInputStream in)
public int available()
available
in interface
LittleEndianInput
(在接口 LittleEndianInput 中可用)
public byte readByte()
readByte
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readByte)
public int readUByte()
readUByte
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readUByte)
public short readShort()
readShort
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readShort)
public int readUShort()
readUShort
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readUShort)
public int readInt()
readInt
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readInt)
public long readLong()
readLong
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readLong)
public double readDouble()
readDouble
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readDouble)
public void readFully(byte[] buf)
readFully
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readFully)
public void readFully(byte[] buf, int off, int len)
readFully
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readFully)
public void readPlain(byte[] buf, int off, int len)
LittleEndianInput
LittleEndianInput.readFully(byte[], int, int)
, but for an encrypted stream the raw (unencrypted) data is filled
(通常行为与 LittleEndianInput.readFully(byte[], int, int) 相同,但对于加密流,原始(未加密)数据被填充)
readPlain
in interface
LittleEndianInput
(接口 LittleEndianInput 中的 readPlain)
buf
- the byte array to receive the bytes
(buf - 接收字节的字节数组)
off
- the start offset into the byte array
(off - 字节数组的起始偏移量)
len
- the amount of bytes to fill
(len - 要填充的字节数)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.