Package org.opensaml.saml.common.binding.artifact

# Class AbstractSAMLArtifact

java.lang.Object
org.opensaml.saml.common.binding.artifact.AbstractSAMLArtifact

All Implemented Interfaces:
  `SAMLArtifact`

Direct Known Subclasses:
  `AbstractSAML1Artifact`, `AbstractSAML2Artifact`

public abstract class AbstractSAMLArtifact extends Object implements SAMLArtifact
Base class for SAML artifacts.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final org.slf4j.Logger`
`log`
Class logger.
`private byte[]`
`typeCode`
2 byte artifact type code.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractSAMLArtifact(byte[] code)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`String`
`base64Encode()`
Gets the Base64 encoded artifact.
`boolean`
`equals(Object o)`
`byte[]`
`getArtifactBytes()`
Gets the bytes for the artifact.
`abstract byte[]`
`getRemainingArtifact()`
Gets the artifact bytes minus the type code.
`byte[]`
`getTypeCode()`
Gets the 2 byte type code for this artifact.
`int`
`hashCode()`
`String`
`hexEncode()`
Gets the hex encoded artifact.
`protected void`
`setTypeCode(byte[] newTypeCode)`
Sets the 2 byte type code for this artifact.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### typeCode

@Nonnull private byte[] typeCode
2 byte artifact type code.

## Constructor Details

### AbstractSAMLArtifact

protected AbstractSAMLArtifact(@Nonnull byte[] code)
Constructor.

Parameters:
  `code` - the artifact type code
Throws:
  `IllegalArgumentException` - thrown if the given type code is not two bytes in length

## Method Details

### getArtifactBytes

@Nonnull public byte[] getArtifactBytes()
Gets the bytes for the artifact.

Specified by:
  `getArtifactBytes` in interface `SAMLArtifact`
Returns:
  the bytes for the artifact

### getTypeCode

@Nonnull public byte[] getTypeCode()
Gets the 2 byte type code for this artifact.

Specified by:
  `getTypeCode` in interface `SAMLArtifact`
Returns:
  the type code for this artifact

### setTypeCode

protected void setTypeCode(@Nonnull byte[] newTypeCode)
Sets the 2 byte type code for this artifact.

Parameters:
  `newTypeCode` - 2 byte type code for this artifact

### getRemainingArtifact

@Nonnull public abstract byte[] getRemainingArtifact()
Gets the artifact bytes minus the type code.

Returns:
  artifact bytes minus the type code

### base64Encode

@Nonnull @NotEmpty public String base64Encode() throws EncodingException
Gets the Base64 encoded artifact.

Returns:
  Base64 encoded artifact.
Throws:
  `EncodingException` - if the artifact could not be base64 encoded.

### hexEncode

@Nonnull @NotEmpty public String hexEncode()
Gets the hex encoded artifact.

Returns:
  hex encoded artifact

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### toString

public String toString()

Overrides:
  `toString` in class `Object`