## org.beepcore.beep.core
Class ByteOutputDataStream

    java.lang.Object
      org.beepcore.beep.core.OutputDataStream
          org.beepcore.beep.core.ByteOutputDataStream

public class ByteOutputDataStream
extends OutputDataStream

`ByteOutputDataStream` represents a BEEP message's payload. Allows the implementor to treat a `byte[]` as a `DataStream`.

Note that this implementation is not synchronized. If multiple threads access a `ByteOutputDataStream` concurrently, data may be inconsistent or lost.

See Also:
  `OutputDataStream`

Field Summary

Fields inherited from class org.beepcore.beep.core.OutputDataStream
`mimeHeaders`

Constructor Summary
`ByteOutputDataStream(byte[] data)` Creates a `ByteOutputDataStream` from a `byte[]` with a content type of `DEFAULT_CONTENT_TYPE` and a transfer encoding of `DEFAULT_CONTENT_TRANSFER_ENCODING`.
`ByteOutputDataStream(byte[] data, int offset, int length)` Creates a `ByteOutputDataStream` from a `byte[]` using the specified length and offset with a content type of `DEFAULT_CONTENT_TYPE` and a transfer encoding of `DEFAULT_CONTENT_TRANSFER_ENCODING`.
`ByteOutputDataStream(java.lang.String contentType, byte[] data)` Creates a `ByteOutputDataStream` from a `byte[]` with a specified content type and a transfer encoding of `DEFAULT_CONTENT_TRANSFER_ENCODING`.
`ByteOutputDataStream(java.lang.String contentType, byte[] data, int offset, int length)` Creates a `ByteOutputDataStream` from a `byte[]` using the specified length and offset and with a specified content type and a transfer encoding of `DEFAULT_CONTENT_TRANSFER_ENCODING`.
`ByteOutputDataStream(java.lang.String contentType, java.lang.String transferEncoding, byte[] data)` Creates a `ByteOutputDataStream` from a `byte[]` with a specified content type and a specified transfer encoding.
`ByteOutputDataStream(java.lang.String contentType, java.lang.String transferEncoding, byte[] data, int offset, int length)` Creates a `ByteOutputDataStream` from a `byte[]` using the specified length and offset and with a specified content type and a specified transfer encoding.

Method Summary
`java.lang.String` `getContentType()` Returns the value of the MIME entity header `Content-Type`.
`java.util.Enumeration` `getHeaderNames()` Returns an `Enumeration` of all the names of the MIME entity headers in this data stream.
`java.lang.String` `getHeaderValue(java.lang.String name)` Retrieves the correspoding `value` to a given a MIME entity header `name`.
`java.lang.String` `getTransferEncoding()` Returns the value of the MIME entity header `Content-Transfer-Encoding`.
`boolean` `isComplete()` Returns `true` if no more bytes will be added to those currently available, if any, on this stream.
`boolean` `removeHeader(java.lang.String name)` Removes the `name` and `value` of a MIME entity header from the data stream.
`void` `setContentType(java.lang.String contentType)` Sets the content type of a `DataStream`.
`void` `setHeaderValue(java.lang.String name, java.lang.String value)` Adds a MIME entity header to this data stream.
`void` `setTransferEncoding(java.lang.String transferEncoding)` Sets the content transfer encoding of a `DataStream`

Methods inherited from class org.beepcore.beep.core.OutputDataStream
`add, close, setComplete`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ByteOutputDataStream

    public ByteOutputDataStream(byte[] data)

  Creates a `ByteOutputDataStream` from a `byte[]` with a content type of `DEFAULT_CONTENT_TYPE` and a transfer encoding of `DEFAULT_CONTENT_TRANSFER_ENCODING`.

Parameters:
  `data` - A `byte[]` representing a message's payload.

### ByteOutputDataStream

    public ByteOutputDataStream(java.lang.String contentType,
                                byte[] data)

  Creates a `ByteOutputDataStream` from a `byte[]` with a specified content type and a transfer encoding of `DEFAULT_CONTENT_TRANSFER_ENCODING`.

Parameters:
  `contentType` - Content type of `data`.
  `data` - A `byte[]` representing a message's payload.

### ByteOutputDataStream

    public ByteOutputDataStream(java.lang.String contentType,
                                java.lang.String transferEncoding,
                                byte[] data)

  Creates a `ByteOutputDataStream` from a `byte[]` with a specified content type and a specified transfer encoding.

Parameters:
  `contentType` - Content type of `data`.
  `transferEncoding` - Encoding Transfer encoding type of `data`.
  `data` - A `byte[]` representing a message's payload.

### ByteOutputDataStream

    public ByteOutputDataStream(byte[] data,
                                int offset,
                                int length)

  Creates a `ByteOutputDataStream` from a `byte[]` using the specified length and offset with a content type of `DEFAULT_CONTENT_TYPE` and a transfer encoding of `DEFAULT_CONTENT_TRANSFER_ENCODING`.

Parameters:
  `data` - A `byte[]` representing a message's payload.
  `offset` - The start offset in array `data` at which the data is written.
  `length` - The maximum number of bytes to read.

### ByteOutputDataStream

    public ByteOutputDataStream(java.lang.String contentType,
                                byte[] data,
                                int offset,
                                int length)

  Creates a `ByteOutputDataStream` from a `byte[]` using the specified length and offset and with a specified content type and a transfer encoding of `DEFAULT_CONTENT_TRANSFER_ENCODING`.

Parameters:
  `contentType` - Content type of `byte[]`.
  `data` - A `byte[]` representing a message's payload.
  `offset` - The start offset in array `data` at which the data is written.
  `length` - The maximum number of bytes to read.

### ByteOutputDataStream

    public ByteOutputDataStream(java.lang.String contentType,
                                java.lang.String transferEncoding,
                                byte[] data,
                                int offset,
                                int length)

  Creates a `ByteOutputDataStream` from a `byte[]` using the specified length and offset and with a specified content type and a specified transfer encoding.

Parameters:
  `contentType` - Content type of `byte[]`.
  `transferEncoding` - Encoding Transfer encoding type of `data`.
  `data` - A `byte[]` representing a message's payload.
  `offset` - The start offset in array `data` at which the data is written.
  `length` - The maximum number of bytes to read.

Method Detail

### isComplete

    public boolean isComplete()

  Returns `true` if no more bytes will be added to those currently available, if any, on this stream. Returns `false` if more bytes are expected.

  Overrides:
    `isComplete` in class `OutputDataStream`

### getContentType

    public java.lang.String getContentType()
                                    throws BEEPException

  Returns the value of the MIME entity header `Content-Type`.

  Throws:
    `BEEPException`

### setContentType

    public void setContentType(java.lang.String contentType)

  Sets the content type of a `DataStream`.

  Parameters:
    `contentType` -

### getTransferEncoding

    public java.lang.String getTransferEncoding()
                                         throws BEEPException

  Returns the value of the MIME entity header `Content-Transfer-Encoding`.

  Throws:
    `BEEPException`

### setTransferEncoding

    public void setTransferEncoding(java.lang.String transferEncoding)

  Sets the content transfer encoding of a `DataStream`

  Parameters:
    `transferEncoding` -

### getHeaderNames

    public java.util.Enumeration getHeaderNames()
                                         throws BEEPException

  Returns an `Enumeration` of all the names of the MIME entity headers in this data stream. Use this call in conjunction with `getHeaderValue` to iterate through all the corresponding MIME entity header `value`(s) in this data stream.

  Returns:
    An `Enumeration` of all the MIME entity header names.
  Throws:
    `BEEPException`

### getHeaderValue

    public java.lang.String getHeaderValue(java.lang.String name)
                                    throws BEEPException

  Retrieves the correspoding `value` to a given a MIME entity header `name`.

  Parameters:
    `name` - Name of the MIME entity header.
  Returns:
    The `value` of the MIME entity header.
  Throws:
    `BEEPException`

### setHeaderValue

    public void setHeaderValue(java.lang.String name,
                               java.lang.String value)

  Adds a MIME entity header to this data stream.

  Parameters:
    `name` - Name of the MIME enitity header.
    `value` - Value of the MIME entity header.

### removeHeader

    public boolean removeHeader(java.lang.String name)

  Removes the `name` and `value` of a MIME entity header from the data stream. Returns `true` if the `name` was successfully removed.

  Parameters:
    `name` - Name of the header to be removed from the data stream.
  Returns:
    Returns true`if header was removed. Otherwise, returns `false`.`

Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.