co.cask.cdap.test
Interface StreamWriter

All Known Implementing Classes:
DefaultStreamWriter

public interface StreamWriter

This interface defines ways to send data to a stream.


Method Summary
 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.
 

Method Detail

send

void send(String content)
          throws IOException
Sends a UTF-8 encoded string to the stream.

Parameters:
content - Data to be sent.
Throws:
IOException - If there is error writing to the stream.

send

void send(byte[] content)
          throws IOException
Sends a byte array to the stream. Same as calling send(content, 0, content.length).

Parameters:
content - Data to be sent.
Throws:
IOException - If there is error writing to the stream.

send

void send(byte[] content,
          int off,
          int len)
          throws IOException
Sends a byte array to the stream.

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

void send(ByteBuffer buffer)
          throws IOException
Sends the content of a ByteBuffer to the stream.

Parameters:
buffer - Data to be sent.
Throws:
IOException - If there is error writing to the stream.

send

void send(Map<String,String> headers,
          String content)
          throws IOException
Sends a UTF-8 encoded string to the stream.

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

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

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

void send(Map<String,String> headers,
          byte[] content,
          int off,
          int len)
          throws IOException
Sends a byte array to the stream.

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

void send(Map<String,String> headers,
          ByteBuffer buffer)
          throws IOException
Sends the content of a ByteBuffer to the stream.

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.


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