Class BinaryValue
- java.lang.Object
-
- org.opends.guitools.controlpanel.datamodel.BinaryValue
-
public class BinaryValue extends Object
Class used to represent Binary Values. This is required in particular when the user wants to use the value in a file. To be able to reflect this this object is used: it contains the binary itself, the base 64 representation and the file that has been used.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBinaryValue.TypeThe type of the binary value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BinaryValuecreateBase64(byte[] bytes)Creates a binary value using an array of bytes.static BinaryValuecreateBase64(String base64)Creates a binary value using a base64 string.static BinaryValuecreateFromFile(byte[] bytes, File file)Creates a binary value using an array of bytes and a file.booleanequals(Object o)StringgetBase64()Returns the base64 representation of the binary value.byte[]getBytes()Returns the byte array of the binary value.FilegetFile()Return the file that was used to read the binary value.BinaryValue.TypegetType()Return the type of the binary value.inthashCode()
-
-
-
Method Detail
-
createBase64
public static BinaryValue createBase64(String base64) throws ParseException
Creates a binary value using a base64 string.- Parameters:
base64- the base64 representation of the binary.- Returns:
- the binary value.
- Throws:
ParseException- if there is an error decoding the provided base64 string.
-
createBase64
public static BinaryValue createBase64(byte[] bytes)
Creates a binary value using an array of bytes.- Parameters:
bytes- the byte array.- Returns:
- the binary value.
-
createFromFile
public static BinaryValue createFromFile(byte[] bytes, File file)
Creates a binary value using an array of bytes and a file.- Parameters:
bytes- the bytes in the file.file- the file the bytes were read from.- Returns:
- the binary value.
-
getBase64
public String getBase64()
Returns the base64 representation of the binary value.- Returns:
- the base64 representation of the binary value.
-
getBytes
public byte[] getBytes() throws ParseExceptionReturns the byte array of the binary value.- Returns:
- the byte array of the binary value.
- Throws:
ParseException- if this object was created using a base64 string and there was an error parsing it.
-
getType
public BinaryValue.Type getType()
Return the type of the binary value.- Returns:
- the type of the binary value.
-
getFile
public File getFile()
Return the file that was used to read the binary value.- Returns:
- the file that was used to read the binary value.
-
-