IDataInput Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The DataInput
interface provides
for reading bytes from a binary stream and
reconstructing from them data in any of
the Java primitive types.
[Android.Runtime.Register("java/io/DataInput", "", "Java.IO.IDataInputInvoker")]
public interface IDataInput : Android.Runtime.IJavaObject, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("java/io/DataInput", "", "Java.IO.IDataInputInvoker")>]
type IDataInput = interface
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Derived
- Attributes
- Implements
Remarks
The DataInput
interface provides for reading bytes from a binary stream and reconstructing from them data in any of the Java primitive types. There is also a facility for reconstructing a String
from data in modified UTF-8 format.
It is generally true of all the reading routines in this interface that if end of file is reached before the desired number of bytes has been read, an EOFException
(which is a kind of IOException
) is thrown. If any byte cannot be read for any reason other than end of file, an IOException
other than EOFException
is thrown. In particular, an IOException
may be thrown if the input stream has been closed.
<h3>"modified-utf-8">Modified UTF-8</h3>
Implementations of the DataInput and DataOutput interfaces represent Unicode strings in a format that is a slight modification of UTF-8. (For information regarding the standard UTF-8 format, see section 3.9 Unicode Encoding Forms of The Unicode Standard, Version 4.0)
<ul> <li>Characters in the range '\u005Cu0001'
to '\u005Cu007F'
are represented by a single byte. <li>The null character '\u005Cu0000'
and characters in the range '\u005Cu0080'
to '\u005Cu07FF'
are represented by a pair of bytes. <li>Characters in the range '\u005Cu0800'
to '\u005CuFFFF'
are represented by three bytes. </ul>
<table class="plain" style="margin-left:2em;"> <caption>Encoding of UTF-8 values</caption> <thead> <tr> <th scope="col" rowspan="2">Value</th> <th scope="col" rowspan="2">Byte</th> <th scope="col" colspan="8" id="bit_a">Bit Values</th> </tr> <tr> <!-- Value --> <!-- Byte --> <th scope="col" style="width:3em"> 7 </th> <th scope="col" style="width:3em"> 6 </th> <th scope="col" style="width:3em"> 5 </th> <th scope="col" style="width:3em"> 4 </th> <th scope="col" style="width:3em"> 3 </th> <th scope="col" style="width:3em"> 2 </th> <th scope="col" style="width:3em"> 1 </th> <th scope="col" style="width:3em"> 0 </th> </thead> <tbody> <tr> <th scope="row" style="text-align:left; font-weight:normal"> \u005Cu0001
to \u005Cu007F
</th> <th scope="row" style="font-weight:normal; text-align:center"> 1 </th> <td style="text-align:center">0 <td colspan="7" style="text-align:right; padding-right:6em">bits 6-0 </tr> <tr> <th scope="row" rowspan="2" style="text-align:left; font-weight:normal"> \u005Cu0000
,<br> \u005Cu0080
to \u005Cu07FF
</th> <th scope="row" style="font-weight:normal; text-align:center"> 1 </th> <td style="text-align:center">1 <td style="text-align:center">1 <td style="text-align:center">0 <td colspan="5" style="text-align:right; padding-right:6em">bits 10-6 </tr> <tr> <!-- (value) --> <th scope="row" style="font-weight:normal; text-align:center"> 2 </th> <td style="text-align:center">1 <td style="text-align:center">0 <td colspan="6" style="text-align:right; padding-right:6em">bits 5-0 </tr> <tr> <th scope="row" rowspan="3" style="text-align:left; font-weight:normal"> \u005Cu0800
to \u005CuFFFF
</th> <th scope="row" style="font-weight:normal; text-align:center"> 1 </th> <td style="text-align:center">1 <td style="text-align:center">1 <td style="text-align:center">1 <td style="text-align:center">0 <td colspan="4" style="text-align:right; padding-right:6em">bits 15-12 </tr> <tr> <!-- (value) --> <th scope="row" style="font-weight:normal; text-align:center"> 2 </th> <td style="text-align:center">1 <td style="text-align:center">0 <td colspan="6" style="text-align:right; padding-right:6em">bits 11-6 </tr> <tr> <!-- (value) --> <th scope="row" style="font-weight:normal; text-align:center"> 3 </th> <td style="text-align:center">1 <td style="text-align:center">0 <td colspan="6" style="text-align:right; padding-right:6em">bits 5-0 </tr> </tbody> </table>
The differences between this format and the standard UTF-8 format are the following: <ul> <li>The null byte '\u005Cu0000'
is encoded in 2-byte format rather than 1-byte, so that the encoded strings never have embedded nulls. <li>Only the 1-byte, 2-byte, and 3-byte formats are used. <li>Supplementary characters are represented in the form of surrogate pairs. </ul>
Added in 1.0.
Java documentation for java.io.DataInput
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Properties
Handle |
Gets the JNI value of the underlying Android object. (Inherited from IJavaObject) |
JniIdentityHashCode |
Returns the value of |
JniManagedPeerState |
State of the managed peer. (Inherited from IJavaPeerable) |
JniPeerMembers |
Member access and invocation support. (Inherited from IJavaPeerable) |
PeerReference |
Returns a JniObjectReference of the wrapped Java object instance. (Inherited from IJavaPeerable) |
Methods
Disposed() |
Called when the instance has been disposed. (Inherited from IJavaPeerable) |
DisposeUnlessReferenced() |
If there are no outstanding references to this instance, then
calls |
Finalized() |
Called when the instance has been finalized. (Inherited from IJavaPeerable) |
ReadBoolean() |
Reads one input byte and returns
|
ReadByte() |
Reads and returns one input byte. |
ReadChar() |
Reads two input bytes and returns a |
ReadDouble() |
Reads eight input bytes and returns
a |
ReadFloat() |
Reads four input bytes and returns
a |
ReadFully(Byte[], Int32, Int32) |
Reads |
ReadFully(Byte[]) |
Reads some bytes from an input
stream and stores them into the buffer
array |
ReadInt() |
Reads four input bytes and returns an
|
ReadLine() |
Reads the next line of text from the input stream. |
ReadLong() |
Reads eight input bytes and returns
a |
ReadShort() |
Reads two input bytes and returns
a |
ReadUnsignedByte() |
Reads one input byte, zero-extends
it to type |
ReadUnsignedShort() |
Reads two input bytes and returns
an |
ReadUTF() |
Reads in a string that has been encoded using a modified UTF-8 format. |
SetJniIdentityHashCode(Int32) |
Set the value returned by |
SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from IJavaPeerable) |
SetPeerReference(JniObjectReference) |
Set the value returned by |
SkipBytes(Int32) |
Makes an attempt to skip over
|
UnregisterFromRuntime() |
Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations. (Inherited from IJavaPeerable) |