Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.ui.resource   Previous This
Package
Next

 


Class DataBoundInputStream

public class DataBoundInputStream extends FilterInputStream
             implements DataInput
{
  // Constructors
  public DataBoundInputStream(InputStream in);
  public DataBoundInputStream(InputStream in, boolean isBig);

  // Methods
  public void align();
  public final boolean getEndian();
  public int read(byte b[]) throws IOException;
  public int read(byte b[], int off, int len) throws IOException;
  public boolean readBoolean() throws IOException;
  public byte readByte() throws IOException;
  public char readChar() throws IOException;
  public double readDouble() throws IOException;
  public float readFloat() throws IOException;
  public void readFully(byte b[]) throws IOException;
  public void readFully(byte b[], int off, int len)
        throws IOException;
  public int readInt() throws IOException;
  public String readLine() throws IOException;
  public long readLong() throws IOException;
  public short readShort() throws IOException;
  public int readUnsignedByte() throws IOException;
  public int readUnsignedShort() throws IOException;
  public String readUTF() throws IOException;
  public final static String readUTF(DataInput in)
        throws IOException;
  public final void setEndian(boolean isBig);
  public int skipBytes(int n) throws IOException;
}

This class enables primitive Java data types to be read from a stream in a portable way. Primitive data types are well understood types with associated operations. For example, integers are considered primitive data types. This class is functionally exactly the same as java.io.DataInputStream except that


   (a) it balances short reads, so that it can DWORD align.

   (b) you can specify whether the file is big endian or little endian.	 

Also see java.io.DataOutputStream, java.io.DataBoundOutputStream

FilterInputStream
  |
  +--DataBoundInputStream

Constructors

DataBoundInputStream

public DataBoundInputStream(InputStream in);

Creates a DataBoundInputStream.

ParameterDescription
in The input stream.

DataBoundInputStream

public DataBoundInputStream(InputStream in, boolean isBig);

Creates a DataBoundInputStream object, defining if it is big endian or not.

ParameterDescription
in The input stream.
isBig Set this parameter to true to indicate big endian format.

Methods

align

public void align();

Sets the file to be DWORD aligned.

Return Value:

No return value.

getEndian

public final boolean getEndian();

Determines if the file is to be read in big endian format.

Return Value:

Returns true if the file should be read in big endian format; otherwise, returns false.

read

public int read(byte b[]) throws IOException;

Reads data into an array of bytes. This method blocks input is available.

Return Value:

Returns the actual number of bytes read; -1 is returned when the end of the stream is reached.

ParameterDescription
b The byte buffer that the data is read into.

Exceptions:

IOException if an I/O error has occurred.

read

public int read(byte b[], int off, int len) throws IOException;

Reads data into an array of bytes. This method blocks until some input is available.

Return Value:

Returns the actual number of bytes read; -1 is returned when the end of the stream is reached.

ParameterDescription
b The byte buffer that the data is read into.
off The starting offset of the data.
len The maximum number of bytes read.

Exceptions:

IOException if an I/O error has occurred.

readBoolean

public boolean readBoolean() throws IOException;

Reads a boolean.

Return Value:

Returns the boolean that is read.

readByte

public byte readByte() throws IOException;

Reads an 8-bit byte.

Return Value:

Returns the 8-bit byte that is read.

readChar

public char readChar() throws IOException;

Reads a 16-bit character.

Return Value:

Returns the 16-bit character that is read.

readDouble

public double readDouble() throws IOException;

Reads a 64-bit double.

Return Value:

Returns the 64-bit double that is read.

readFloat

public float readFloat() throws IOException;

Reads a 32-bit float.

Return Value:

Returns the 32-bit float that is read.

readFully

public void readFully(byte b[]) throws IOException;

Reads bytes, blocking until all bytes are read.

Return Value:

No return value.

ParameterDescription
b The byte buffer that the data is read into.

Exceptions:

IOException if an I/O error has occurred.

EOFException if EOF is reached before all bytes are read.

readFully

public void readFully(byte b[], int off, int len) throws IOException;

Reads bytes, blocking until all bytes are read.

Return Value:

No return value.

ParameterDescription
b The buffer that the data is read into.
off The starting offset of the data.
len The maximum number of bytes read.

Exceptions:

IOException if an I/O error has occurred.

EOFException if EOF reached before all bytes are read.

readInt

public int readInt() throws IOException;

Reads a 32-bit integer.

Return Value:

Returns the 32-bit integer that is read.

readLine

public String readLine() throws IOException;

Reads in a line that has been terminated by a \n, \r, \r\n, or EOF.

Note This method does not properly convert bytes to characters. Since the release of JDK version 1.1, the preferred way to read lines of text is via the BufferedReader.readLine() method.

Return Value:

Returns a string copy of the line.

readLong

public long readLong() throws IOException;

Reads a 64-bit long.

Return Value:

Returns the 64-bit long that is read.

readShort

public short readShort() throws IOException;

Reads a 16-bit short.

Return Value:

Returns the 16-bit short that is read.

readUnsignedByte

public int readUnsignedByte() throws IOException;

Reads an unsigned 8-bit byte.

Return Value:

Returns the 8-bit byte that is read.

readUnsignedShort

public int readUnsignedShort() throws IOException;

Reads a 16-bit short.

Return Value:

Returns the 16-bit short that is read.

readUTF

public String readUTF() throws IOException;

Reads a UTF format string.

Return Value:

Returns the String.

readUTF

public final static String readUTF(DataInput in) throws IOException;

Reads a UTF format string.

Return Value:

Returns the String.

setEndian

public final void setEndian(boolean isBig);

Indicates whether the file is to be read in big endian format.

Return Value:

No return value.

ParameterDescription
isBig Set this parameter to true to indicate big endian format.

skipBytes

public int skipBytes(int n) throws IOException;

Skips bytes, blocking until all bytes are skipped.

Return Value:

Returns the actual number of bytes skipped.

ParameterDescription
n The number of bytes to be skipped.

Exceptions:

IOException if an I/O error has occurred.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.