public abstract class DataInput
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
DataInput() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone of this stream.
|
abstract byte |
readByte()
Reads and returns a single byte.
|
abstract void |
readBytes(byte[] b,
int offset,
int len)
Reads a specified number of bytes into an array at the specified offset.
|
void |
readBytes(byte[] b,
int offset,
int len,
boolean useBuffer)
Reads a specified number of bytes into an array at the
specified offset with control over whether the read
should be buffered (callers who have their own buffer
should pass in "false" for useBuffer).
|
void |
readChars(char[] buffer,
int start,
int length)
Deprecated.
-- please use readString or readBytes
instead, and construct the string
from those utf8 bytes
|
int |
readInt()
Reads four bytes and returns an int.
|
long |
readLong()
Reads eight bytes and returns a long.
|
short |
readShort()
Reads two bytes and returns a short.
|
java.lang.String |
readString()
Reads a string.
|
java.util.Map<java.lang.String,java.lang.String> |
readStringStringMap() |
int |
readVInt()
Reads an int stored in variable-length format.
|
long |
readVLong()
Reads a long stored in variable-length format.
|
void |
setModifiedUTF8StringsMode()
Call this if readString should read characters stored
in the old modified UTF8 format (length in java chars
and java's modified UTF8 encoding).
|
public void setModifiedUTF8StringsMode()
public abstract byte readByte() throws java.io.IOException
java.io.IOException
DataOutput.writeByte(byte)
public abstract void readBytes(byte[] b, int offset, int len) throws java.io.IOException
b
- the array to read bytes intooffset
- the offset in the array to start storing byteslen
- the number of bytes to readjava.io.IOException
DataOutput.writeBytes(byte[],int)
public void readBytes(byte[] b, int offset, int len, boolean useBuffer) throws java.io.IOException
BufferedIndexInput
respects this parameter.b
- the array to read bytes intooffset
- the offset in the array to start storing byteslen
- the number of bytes to readuseBuffer
- set to false if the caller will handle
buffering.java.io.IOException
DataOutput.writeBytes(byte[],int)
public short readShort() throws java.io.IOException
java.io.IOException
DataOutput.writeByte(byte)
public int readInt() throws java.io.IOException
java.io.IOException
DataOutput.writeInt(int)
public int readVInt() throws java.io.IOException
java.io.IOException
DataOutput.writeVInt(int)
public long readLong() throws java.io.IOException
java.io.IOException
DataOutput.writeLong(long)
public long readVLong() throws java.io.IOException
java.io.IOException
public java.lang.String readString() throws java.io.IOException
java.io.IOException
DataOutput.writeString(String)
@Deprecated public void readChars(char[] buffer, int start, int length) throws java.io.IOException
buffer
- the array to read characters intostart
- the offset in the array to start storing characterslength
- the number of characters to readjava.io.IOException
DataOutput.writeChars(String,int,int)
public java.lang.Object clone()
Clones of a stream access the same data, and are positioned at the same point as the stream they were cloned from.
Expert: Subclasses must ensure that clones may be positioned at different points in the input from each other and from the stream they were cloned from.
clone
in class java.lang.Object
public java.util.Map<java.lang.String,java.lang.String> readStringStringMap() throws java.io.IOException
java.io.IOException
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.