org.apache.shiro.util
Class SimpleByteSource

java.lang.Object
  extended by org.apache.shiro.util.SimpleByteSource
All Implemented Interfaces:
ByteSource

public class SimpleByteSource
extends Object
implements ByteSource

Very simple ByteSource implementation that maintains an internal byte[] array and uses the Hex and Base64 codec classes to support the toHex() and toBase64() implementations.

Since:
1.0
Author:
Les Hazlewood

Constructor Summary
SimpleByteSource(byte[] bytes)
           
 
Method Summary
 boolean equals(Object o)
           
 byte[] getBytes()
          Returns the wrapped byte array.
 int hashCode()
           
 String toBase64()
          Returns the Base 64-formatted String representation of the underlying wrapped byte array.
 String toHex()
          Returns the Hex-formatted String representation of the underlying wrapped byte array.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleByteSource

public SimpleByteSource(byte[] bytes)
Method Detail

getBytes

public byte[] getBytes()
Description copied from interface: ByteSource
Returns the wrapped byte array.

Specified by:
getBytes in interface ByteSource
Returns:
the wrapped byte array.

toHex

public String toHex()
Description copied from interface: ByteSource
Returns the Hex-formatted String representation of the underlying wrapped byte array.

Specified by:
toHex in interface ByteSource
Returns:
the Hex-formatted String representation of the underlying wrapped byte array.

toBase64

public String toBase64()
Description copied from interface: ByteSource
Returns the Base 64-formatted String representation of the underlying wrapped byte array.

Specified by:
toBase64 in interface ByteSource
Returns:
the Base 64-formatted String representation of the underlying wrapped byte array.

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.