Class List Method List File List

# Class: Vertx::PacketWritestream

Inherits:
  Object
  - Object
  - Vertx::PacketWritestream
  show all
Includes:
  WriteStream
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/packet_writestream.rb

## Overview

A WriteStream for sending packets to a SocketAddress. The stream is called when the write fails.

## Instance Method Summary (collapse)

- - (self) drain_handler { ... }
- - (self) exception_handler { ... }
- - (self) set_write_queue_max_size(maxSize = nil)
- - (self) write(data = nil)
- - (true, false) write_queue_full?
  This will return true if there are more bytes in the write queue than the value set using #set_write_queue_max_size.

## Instance Method Details

### - (`self`) drain_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    57
    58
    59
    60
    61
    62
    63
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/packet_writestream.rb', line 57

    def drain_handler
      if block_given?
        @j_del.java_method(:drainHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling drain_handler()"
    end

### - (`self`) exception_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    30
    31
    32
    33
    34
    35
    36
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/packet_writestream.rb', line 30

    def exception_handler
      if block_given?
        @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling exception_handler()"
    end

### - (`self`) set_write_queue_max_size(maxSize = nil)

Parameters:

- maxSize (`Fixnum`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    48
    49
    50
    51
    52
    53
    54
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/packet_writestream.rb', line 48

    def set_write_queue_max_size(maxSize=nil)
      if maxSize.class == Fixnum && !block_given?
        @j_del.java_method(:setWriteQueueMaxSize, [Java::int.java_class]).call(maxSize)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_write_queue_max_size(maxSize)"
    end

### - (`self`) write(data = nil)

Parameters:

- data (`::Vertx::Buffer`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    39
    40
    41
    42
    43
    44
    45
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/packet_writestream.rb', line 39

    def write(data=nil)
      if data.class.method_defined?(:j_del) && !block_given?
        @j_del.java_method(:write, [Java::IoVertxCoreBuffer::Buffer.java_class]).call(data.j_del)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling write(data)"
    end

### - (`true`, `false`) write_queue_full?

This will return `true` if there are more bytes in the write queue than the value set using #set_write_queue_max_size

Returns:

- (`true`, `false`) —
  true if write queue is full

Raises:

- (`ArgumentError`)

    22
    23
    24
    25
    26
    27
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/packet_writestream.rb', line 22

    def write_queue_full?
      if !block_given?
        return @j_del.java_method(:writeQueueFull, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling write_queue_full?()"
    end