Class: LogStash::Inputs::Tcp::DecoderImpl
- Inherits:
-
Object
- Object
- LogStash::Inputs::Tcp::DecoderImpl
- Defined in:
- lib/logstash/inputs/tcp/decoder_impl.rb
Instance Method Summary collapse
- #copy ⇒ Object
- #decode(channel_addr, data) ⇒ Object
- #flush ⇒ Object
-
#initialize(codec, tcp) ⇒ DecoderImpl
constructor
A new instance of DecoderImpl.
Constructor Details
#initialize(codec, tcp) ⇒ DecoderImpl
Returns a new instance of DecoderImpl.
8 9 10 11 12 |
# File 'lib/logstash/inputs/tcp/decoder_impl.rb', line 8 def initialize(codec, tcp) @tcp = tcp @codec = codec @first_read = true end |
Instance Method Details
#copy ⇒ Object
26 27 28 |
# File 'lib/logstash/inputs/tcp/decoder_impl.rb', line 26 def copy self.class.new(@codec.clone, @tcp) end |
#decode(channel_addr, data) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/logstash/inputs/tcp/decoder_impl.rb', line 14 def decode(channel_addr, data) bytes = Java::byte[data.readableBytes].new data.getBytes(0, bytes) data.release tbuf = String.from_java_bytes bytes, "ASCII-8BIT" if @first_read tbuf = init_first_read(channel_addr, tbuf) end @tcp.decode_buffer(@ip_address, @address, @port, @codec, @proxy_address, @proxy_port, tbuf, nil) end |
#flush ⇒ Object
30 31 32 |
# File 'lib/logstash/inputs/tcp/decoder_impl.rb', line 30 def flush @tcp.flush_codec(@codec, @ip_address, @address, @port, nil) end |