Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.infinispan.schematic.internal.io
Class BsonDataInput

    java.lang.Object
      org.infinispan.schematic.internal.io.BsonDataInput

All Implemented Interfaces:
  DataInput

    public class BsonDataInput

extends Object
implements DataInput

An implementation of `DataInput` with additional methods needed for reading BSON formatted content from another DataInput instance. Specifically, this class reads little-endian byte order (purposefully in violation of the DataInput interface specification) and provides a way to read C-style strings (where the length is not known up front but instead contain all characters until the zero-byte terminator), which are commonly used within the BSON specification.

Since:
  5.1
Author:
  Randall Hauch (C) 2011 Red Hat Inc.

Constructor Summary
`BsonDataInput(DataInput input)`

Method Summary
`int` | `getTotalBytesRead()` Returns the number of bytes that have been read from this input.
`protected int` | `read()`
`protected int` | `read(byte[] b, int off, int len)`
`boolean` | `readBoolean()`
`byte` | `readByte()`
`char` | `readChar()`
`double` | `readDouble()`
`float` | `readFloat()`
`void` | `readFully(byte[] b)`
`void` | `readFully(byte[] b, int off, int len)`
`int` | `readInt()`
`String` | `readLine()`
`long` | `readLong()`
`short` | `readShort()`
`int` | `readUnsignedByte()`
`int` | `readUnsignedShort()`
`String` | `readUTF()`
`static String` | `readUTF(DataInput dis, int len)` Utility method to read a UTF-8 string from the supplied DataInput object given the supplied number of bytes to read or, if the number of bytes is not known, all of the UTF-8 characters until the next zero-byte value.
`String` | `readUTF(int len)` Read a UTF-8 string with the supplied length or, if the length is not known, the UTF-8 characters until the next zero-byte value.
`int` | `skipBytes(int n)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BsonDataInput

    public BsonDataInput(DataInput input)

Method Detail

### getTotalBytesRead

    public int getTotalBytesRead()
                          throws IOException

  Returns the number of bytes that have been read from this input.

  Returns:
    the total number of bytes already read
  Throws:
    `IOException` - if an I/O error occurs.

### readUnsignedByte

    public final int readUnsignedByte()
                               throws IOException

  Specified by:
    `readUnsignedByte` in interface `DataInput`
  Throws:
    `IOException`

### readBoolean

    public boolean readBoolean()
                        throws IOException

  Specified by:
    `readBoolean` in interface `DataInput`
  Throws:
    `IOException`

### readByte

    public byte readByte()
                  throws IOException

  Specified by:
    `readByte` in interface `DataInput`
  Throws:
    `IOException`

### readChar

    public char readChar()
                  throws IOException

  Specified by:
    `readChar` in interface `DataInput`
  Throws:
    `IOException`

### readUnsignedShort

    public int readUnsignedShort()
                          throws IOException

  Specified by:
    `readUnsignedShort` in interface `DataInput`
  Throws:
    `IOException`

### readShort

    public short readShort()
                    throws IOException

  Specified by:
    `readShort` in interface `DataInput`
  Throws:
    `IOException`

### readInt

    public int readInt()
                throws IOException

  Specified by:
    `readInt` in interface `DataInput`
  Throws:
    `IOException`

### readLong

    public long readLong()
                  throws IOException

  Specified by:
    `readLong` in interface `DataInput`
  Throws:
    `IOException`

### readFloat

    public float readFloat()
                    throws IOException

  Specified by:
    `readFloat` in interface `DataInput`
  Throws:
    `IOException`

### readDouble

    public double readDouble()
                      throws IOException

  Specified by:
    `readDouble` in interface `DataInput`
  Throws:
    `IOException`

### readFully

    public void readFully(byte[] b)
                   throws IOException

  Specified by:
    `readFully` in interface `DataInput`
  Throws:
    `IOException`

### readFully

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

  Specified by:
    `readFully` in interface `DataInput`
  Throws:
    `IOException`

### read

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

  Throws:
    `IOException`

### read

    protected final int read()
                      throws IOException

  Throws:
    `IOException`

### skipBytes

    public int skipBytes(int n)
                  throws IOException

  Specified by:
    `skipBytes` in interface `DataInput`
  Throws:
    `IOException`

### readLine

    public String readLine()

  Specified by:
    `readLine` in interface `DataInput`

### readUTF

    public String readUTF()
                   throws IOException

  Specified by:
    `readUTF` in interface `DataInput`
  Throws:
    `IOException`

### readUTF

    public String readUTF(int len)
                   throws IOException

  Read a UTF-8 string with the supplied length or, if the length is not known, the UTF-8 characters until the next zero-byte value. Note that this is different than the `standard way` to read a string, which always expects the length to be the first value on the stream.

  Parameters:
    `len` - the number of bytes to read, or -1 if the length is not known and characters should be read until the next zero-byte string.
  Returns:
    the read UTF-8 string
  Throws:
    `IOException`

### readUTF

    public static String readUTF(DataInput dis,
                                 int len)
                          throws IOException

  Utility method to read a UTF-8 string from the supplied DataInput object given the supplied number of bytes to read or, if the number of bytes is not known, all of the UTF-8 characters until the next zero-byte value. Note that this is different than the `standard way` to read a string, which always expects the length to be the first value on the stream.

  Parameters:
    `dis` - the DataInput from which the UTF-8 string is to be read
    `len` - the number of bytes to read, or -1 if the length is not known and characters should be read until the next zero-byte string.
  Returns:
    the read UTF-8 string
  Throws:
    `IOException` - if there is a problem reading from the input

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.