Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Octet

A binary representation of a 8 bit value.

{@see https://en.wikipedia.org/wiki/Octet_(computing)} for more information on Octets

An octet is used in the textual representation of an IPv4 number, where the IP number value is divided into 4 octets

Hierarchy

  • Octet

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Octet(givenValue: string | number): Octet
  • Constructor for creating an instance of an Octet.

    The constructor parameter given could either be a string or number.

    If a string, it is the string representation of the numeric value of the octet If a number, it is the numeric representation of the value of the octet

    Parameters

    • givenValue: string | number

      value of the octet to be created.

    Returns Octet

Properties

Private value

value: number

Methods

getValue

  • getValue(): number
  • Method to get the numeric value of the octet

    Returns number

    the numeric value of the octet

toString

  • toString(): string
  • Returns a decimal representation of the value of the octet in string

    Returns string

    a decimal representation of the value of the octet in string

Static fromNumber

  • fromNumber(rawValue: number): Octet
  • Convenience method for creating an Octet out of a numeric value representing the value of the octet

    Parameters

    • rawValue: number

      the octet value in number

    Returns Octet

    the Octet instance

Static fromString

  • fromString(rawValue: string): Octet
  • Convenience method for creating an Octet out of a string value representing the value of the octet

    Parameters

    • rawValue: string

      the octet value in string

    Returns Octet

    the Octet instance

Generated using TypeDoc