com.sap.aii.af.service.cpa

Class BinaryData

java.lang.Object
  extended by com.sap.aii.af.service.cpa.BinaryData
All Implemented Interfaces:
Serializable, Cloneable

public class BinaryData
extends Object
implements Cloneable, Serializable

Attribute extended CPAObjects (i.e. currently only the Channel object) support CPA Cache specific data types, besides the following basic Java types: String, int, long and boolean. The data fields of the adapter type specific Channel object can be defined through the adapter type meta data (schema). Currently supported additional data types are the BinaryData and TableData object. Such data fields can be read from a Channel object by the attribute name (defined in the schema), using the methods getValueAsBinary or getValueAsTable. The adapters using the CPA Cache service API should never need to create the described data container objects and should always retrieve them from a given Channel object, instead.

The BinaryData object is a container for binary data, which can be read from the Channel object, as configured in the Integration Directory or PCK configuration UI. Base64 encoding is supported.

See Also:
TableData, Serialized Form

Constructor Summary
BinaryData(byte[] binary)
          The default constructor for the BinaryData object.
BinaryData(byte[] encodedBinary, boolean base64Encoded)
          The constructor for the BinaryData object with Base64 encoded binary data.
 
Method Summary
 Object clone()
          This method clones the contained byte array, in case that it is not null.
 byte[] getData()
          Returns the binary data as it is (either raw or Base64 encoded).
 byte[] getDataBase64()
          Returns the binary data in Base64 encoded form.
 byte[] getDataRaw()
          Returns the binary data in raw form.
 boolean isBase64Encoded()
          Returns if the binary data is Base64 encoded, or not.
 void setData(byte[] binary)
          Sets the binary data (not Base64 encoded).
 void setData(byte[] binary, boolean base64Encoded)
          Sets the binary data (either raw or Base64 encoded).
 int size()
          Return the size of the byte array, or -1 in case of the content being null.
 String toBase64EncodedString()
          Returns the binary data as String (in Base64 encoded form).
 String toRawString()
          Returns the binary data as String (in raw form).
 String toString()
          Returns the binary data as String (either raw or Base64 encoded).
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinaryData

public BinaryData(byte[] binary)
The default constructor for the BinaryData object.

Parameters:
binary - The binary data as byte array.

BinaryData

public BinaryData(byte[] encodedBinary,
                  boolean base64Encoded)
The constructor for the BinaryData object with Base64 encoded binary data.

Parameters:
encodedBinary - The binary data as byte array. Needs to be Base64 encoded, if the base64Encoded param is set to true.
base64Encoded - Specifies if the encodedBinary byte array contains binary data is Base64 encoded form, or not.
Method Detail

size

public int size()
Return the size of the byte array, or -1 in case of the content being null.


setData

public void setData(byte[] binary)
Sets the binary data (not Base64 encoded).

Parameters:
binary - The binary data as byte array.

setData

public void setData(byte[] binary,
                    boolean base64Encoded)
Sets the binary data (either raw or Base64 encoded).

Parameters:
binary - The binary data as byte array, either raw or Base64 encoded, depending on the base64Encoded paramter.
base64Encoded - Specifies, if the data given in the binary byte array is Base64 encoded, or not.

getData

public byte[] getData()
Returns the binary data as it is (either raw or Base64 encoded). The encoding can be checked using the isBase64Encoded method.

Returns:
The binary data as byte array (either raw or Base64 encoded).

getDataRaw

public byte[] getDataRaw()
Returns the binary data in raw form.

Returns:
The binary data as byte array (raw).

getDataBase64

public byte[] getDataBase64()
Returns the binary data in Base64 encoded form.

Returns:
The binary data as byte array (Base64 encoded).

isBase64Encoded

public boolean isBase64Encoded()
Returns if the binary data is Base64 encoded, or not.

Returns:
True, if the binary data is Base64 encoded, otherwise false.

toString

public String toString()
Returns the binary data as String (either raw or Base64 encoded). The encoding can be checked using the isBase64Encoded method.

Overrides:
toString in class Object
Returns:
The binary data as String (either raw or Base64 encoded).

toRawString

public String toRawString()
Returns the binary data as String (in raw form).

Returns:
The binary data as String (raw).

toBase64EncodedString

public String toBase64EncodedString()
Returns the binary data as String (in Base64 encoded form).

Returns:
The binary data as String (Base64 encoded).

clone

public Object clone()
             throws CloneNotSupportedException
This method clones the contained byte array, in case that it is not null.

Overrides:
clone in class Object
Returns:
The cloned binary data object.
Throws:
CloneNotSupportedException
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] SAP_XIAF [sap.com] com.sap.aii.af.svc.facade api BC-XI


Copyright 2014 SAP AG Complete Copyright Notice