com.jscape.inet.dns

## Class DnsInputStream

- java.lang.Object
- - java.io.InputStream
  - - java.io.ByteArrayInputStream
    - - com.jscape.inet.dns.DnsInputStream

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

      public class DnsInputStream
      extends java.io.ByteArrayInputStream

  InputStream responsible for parsing byte[] data retrieved in communcations with a Dns server.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DnsInputStream(byte[] data, int off, int len)` Constructs a new `DnsInputStream` instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `readByte()` Reads the next byte of data from this input stream.
    `java.lang.String` | `readDomainName()` Parses out domain name from response.
    `long` | `readInt()` Reads four input bytes and returns an int value.
    `DnsRecord` | `readRecord()` Reads a `DnsRecord` from response.
    `int` | `readShort()` Reads two input bytes and returns a unsigned short value.
    `java.lang.String` | `readString()` Reads String from response.

    - ### Methods inherited from class java.io.ByteArrayInputStream

      `available, close, mark, markSupported, read, read, reset, skip`

    - ### Methods inherited from class java.io.InputStream

      `read`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DnsInputStream

          public DnsInputStream(byte[] data,
                                int off,
                                int len)

      Constructs a new `DnsInputStream` instance.
      Parameters:
        `data` - the input buffer
        `off` - the offset in the buffer of the first byte to read.
        `len` - the maximum number of bytes to read from the buffer.

  - ### Method Detail

    - #### readByte

          public int readByte()
                       throws java.io.IOException

      Reads the next byte of data from this input stream.
      Returns:
        the 8-bit value read.
      Throws:
        `java.io.IOException` - if an I/O error occurs

    - #### readShort

          public int readShort()
                        throws java.io.IOException

      Reads two input bytes and returns a unsigned short value.
      Returns:
        the 16-bit value read.
      Throws:
        `java.io.IOException` - if an I/O error occurs

    - #### readInt

          public long readInt()
                       throws java.io.IOException

      Reads four input bytes and returns an int value.
      Returns:
        the int value read.
      Throws:
        `java.io.IOException` - if an I/O error occurs

    - #### readString

          public java.lang.String readString()
                                      throws java.io.IOException

      Reads String from response.
      Returns:
        the String read.
      Throws:
        `java.io.IOException` - if an I/O error occurs

    - #### readDomainName

          public java.lang.String readDomainName()
                                          throws java.io.IOException

      Parses out domain name from response.
      Returns:
        domain name
      Throws:
        `java.io.IOException` - if an I/O error occurs

    - #### readRecord

          public DnsRecord readRecord()
                               throws java.io.IOException

      Reads a `DnsRecord` from response.
      Returns:
        the `DnsRecord` read.
      Throws:
        `java.io.IOException` - if an I/O error occurs
      See Also:
        `DnsRecord`

Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved