public final class DefaultStreamWriter extends Object implements StreamWriter
| Constructor and Description |
|---|
DefaultStreamWriter(co.cask.cdap.data.stream.service.StreamHandler streamHandler,
co.cask.cdap.common.queue.QueueName streamName,
String accountId) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
@Inject
public DefaultStreamWriter(co.cask.cdap.data.stream.service.StreamHandler streamHandler,
co.cask.cdap.common.queue.QueueName streamName,
String accountId)
throws IOException
IOExceptionpublic void send(String content) throws IOException
StreamWritersend in interface StreamWritercontent - Data to be sent.IOException - If there is error writing to the stream.public void send(byte[] content)
throws IOException
StreamWritersend(content, 0, content.length).send in interface StreamWritercontent - Data to be sent.IOException - If there is error writing to the stream.public void send(byte[] content,
int off,
int len)
throws IOException
StreamWritersend in interface StreamWritercontent - Data to be sent.off - Offset in the array to start withlen - Number of bytes to sent starting from off.IOException - If there is error writing to the stream.public void send(ByteBuffer buffer) throws IOException
StreamWriterByteBuffer to the stream.send in interface StreamWriterbuffer - Data to be sent.IOException - If there is error writing to the stream.public void send(Map<String,String> headers, String content) throws IOException
StreamWritersend in interface StreamWriterheaders - Key-value pairs to be sent as
headers of StreamEvent.content - Data to be sent.IOException - If there is error writing to the stream.public void send(Map<String,String> headers, byte[] content) throws IOException
StreamWritersend(content, 0, content.length).send in interface StreamWriterheaders - Key-value pairs to be sent as
headers of StreamEvent.content - Data to be sent.IOException - If there is error writing to the stream.public void send(Map<String,String> headers, byte[] content, int off, int len) throws IOException
StreamWritersend in interface StreamWriterheaders - Key-value pairs to be sent as
headers of StreamEvent.content - Data to be sent.off - Offset in the array to start withlen - Number of bytes to sent starting from off.IOException - If there is error writing to the stream.public void send(Map<String,String> headers, ByteBuffer buffer) throws IOException
StreamWriterByteBuffer to the stream.send in interface StreamWriterheaders - Key-value pairs to be sent as
headers of StreamEvent.buffer - Data to be sent.IOException - If there is error writing to the stream.Copyright © 2015 Cask Data, Inc. Licensed under the Apache License, Version 2.0.