co.cask.cdap.test.internal
Class DefaultStreamWriter

java.lang.Object
  extended by co.cask.cdap.test.internal.DefaultStreamWriter
All Implemented Interfaces:
StreamWriter

public final class DefaultStreamWriter
extends Object
implements StreamWriter


Constructor Summary
DefaultStreamWriter(co.cask.cdap.data.stream.service.StreamHandler streamHandler, co.cask.cdap.common.queue.QueueName streamName, String accountId)
           
 
Method Summary
protected  void finalize()
           
 void send(byte[] content)
          Sends a byte array to the stream.
 void send(byte[] content, int off, int len)
          Sends a byte array to the stream.
 void send(ByteBuffer buffer)
          Sends the content of a ByteBuffer to the stream.
 void send(Map<String,String> headers, byte[] content)
          Sends a byte array to the stream.
 void send(Map<String,String> headers, byte[] content, int off, int len)
          Sends a byte array to the stream.
 void send(Map<String,String> headers, ByteBuffer buffer)
          Sends the content of a ByteBuffer to the stream.
 void send(Map<String,String> headers, String content)
          Sends a UTF-8 encoded string to the stream.
 void send(String content)
          Sends a UTF-8 encoded string to the stream.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultStreamWriter

@Inject
public DefaultStreamWriter(co.cask.cdap.data.stream.service.StreamHandler streamHandler,
                                  co.cask.cdap.common.queue.QueueName streamName,
                                  String accountId)
                    throws IOException
Throws:
IOException
Method Detail

send

public void send(String content)
          throws IOException
Description copied from interface: StreamWriter
Sends a UTF-8 encoded string to the stream.

Specified by:
send in interface StreamWriter
Parameters:
content - Data to be sent.
Throws:
IOException - If there is error writing to the stream.

send

public void send(byte[] content)
          throws IOException
Description copied from interface: StreamWriter
Sends a byte array to the stream. Same as calling send(content, 0, content.length).

Specified by:
send in interface StreamWriter
Parameters:
content - Data to be sent.
Throws:
IOException - If there is error writing to the stream.

send

public void send(byte[] content,
                 int off,
                 int len)
          throws IOException
Description copied from interface: StreamWriter
Sends a byte array to the stream.

Specified by:
send in interface StreamWriter
Parameters:
content - Data to be sent.
off - Offset in the array to start with
len - Number of bytes to sent starting from off.
Throws:
IOException - If there is error writing to the stream.

send

public void send(ByteBuffer buffer)
          throws IOException
Description copied from interface: StreamWriter
Sends the content of a ByteBuffer to the stream.

Specified by:
send in interface StreamWriter
Parameters:
buffer - Data to be sent.
Throws:
IOException - If there is error writing to the stream.

send

public void send(Map<String,String> headers,
                 String content)
          throws IOException
Description copied from interface: StreamWriter
Sends a UTF-8 encoded string to the stream.

Specified by:
send in interface StreamWriter
Parameters:
headers - Key-value pairs to be sent as headers of StreamEvent.
content - Data to be sent.
Throws:
IOException - If there is error writing to the stream.

send

public void send(Map<String,String> headers,
                 byte[] content)
          throws IOException
Description copied from interface: StreamWriter
Sends a byte array to the stream. Same as calling send(content, 0, content.length).

Specified by:
send in interface StreamWriter
Parameters:
headers - Key-value pairs to be sent as headers of StreamEvent.
content - Data to be sent.
Throws:
IOException - If there is error writing to the stream.

send

public void send(Map<String,String> headers,
                 byte[] content,
                 int off,
                 int len)
          throws IOException
Description copied from interface: StreamWriter
Sends a byte array to the stream.

Specified by:
send in interface StreamWriter
Parameters:
headers - Key-value pairs to be sent as headers of StreamEvent.
content - Data to be sent.
off - Offset in the array to start with
len - Number of bytes to sent starting from off.
Throws:
IOException - If there is error writing to the stream.

send

public void send(Map<String,String> headers,
                 ByteBuffer buffer)
          throws IOException
Description copied from interface: StreamWriter
Sends the content of a ByteBuffer to the stream.

Specified by:
send in interface StreamWriter
Parameters:
headers - Key-value pairs to be sent as headers of StreamEvent.
buffer - Data to be sent.
Throws:
IOException - If there is error writing to the stream.

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2015 Cask Data, Inc. Licensed under the Apache License, Version 2.0.