Class IError
- java.lang.Object
-
- com.avpkit.ferry.RefCounted
-
- com.avpkit.core.IError
-
public class IError extends RefCounted
Maps from int return codes to defined Error values.
This class is used to map from AVPKit return codes
(for example on {IContainer#readNextPacket(IPacket)}
into an enum type if the error is known and a text description.
WARNING: Do not write code that depends on the integer values
returned from AVPKit; instead use the integer value to create
one of these objects. That's because integer values returned
from methods can have different meanings on different OS systems
(for example, ERROR_AGAIN is -11 on Linux, but a different
value on MacOS). This class maps the error to a os-type-safe
value.
Also, do not depend on the string messages staying constant. They
are for debugging purposes only. And we can't control whether or
not they are localized -- that's up to your OS. Sorry.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIError.TypeA set of errors that AVPKit knows about.
-
Field Summary
-
Fields inherited from class com.avpkit.ferry.RefCounted
swigCMemOwn
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IErrorcopyReference()Create a new IError object that is actually referring to the exact same underlying native object.booleanequals(java.lang.Object obj)Compares two values, returning true if the underlying objects in native code are the same object.static IError.TypeerrorNumberToType(int errorNo)Translate an error number to a type.static longgetCPtr(IError obj)Internal Only.java.lang.StringgetDescription()Get a text description for this error.
The description returned will be in whatever language
the underlying OS decides to use, and no, we can't
support localization here if the OS hasn't already done it.
Sorry.
intgetErrorNumber()Return the raw integer value that AVPKit returned and
was used to create this IError.
Note that this value can have different meanings on
different operating systems.longgetMyCPtr()Internal Only.IError.TypegetType()Get the OS-independent AVPKit type for this error.
inthashCode()Get a hashable value for this object.static IErrormake(int errorNumber)Create a new IError object from a return value passed in from AVPKit.
static IErrormake(IError.Type type)Create a new IError object from an IError.Type enum value.
java.lang.StringtoString()Return a string representation of this errorstatic inttypeToErrorNumber(IError.Type type)Translate an a type to an error number.-
Methods inherited from class com.avpkit.ferry.RefCounted
acquire, delete, getCPtr, getCurrentRefCount, getJavaRefCount, release
-
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(IError obj)
Internal Only. Not part of public API. Get the raw value of the native object that obj is proxying for.- Parameters:
obj- The java proxy object for a native object.- Returns:
- The raw pointer obj is proxying for.
-
getMyCPtr
public long getMyCPtr()
Internal Only. Not part of public API. Get the raw value of the native object that we're proxying for.- Overrides:
getMyCPtrin classRefCounted- Returns:
- The raw pointer we're proxying for.
-
copyReference
public IError copyReference()
Create a new IError object that is actually referring to the exact same underlying native object.- Overrides:
copyReferencein classRefCounted- Returns:
- the new Java object.
-
equals
public boolean equals(java.lang.Object obj)
Compares two values, returning true if the underlying objects in native code are the same object. That means you can have two different Java objects, but when you do a comparison, you'll find out they are the EXACT same object.- Overrides:
equalsin classjava.lang.Object- Returns:
- True if the underlying native object is the same. False otherwise.
-
hashCode
public int hashCode()
Get a hashable value for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hashable value.
-
toString
public java.lang.String toString()
Return a string representation of this error- Overrides:
toStringin classjava.lang.Object- Returns:
- the error as a string
-
getType
public IError.Type getType()
Get the OS-independent AVPKit type for this error.
- Returns:
- the type.
-
getDescription
public java.lang.String getDescription()
Get a text description for this error.
The description returned will be in whatever language
the underlying OS decides to use, and no, we can't
support localization here if the OS hasn't already done it.
Sorry.
- Returns:
- the description.
-
getErrorNumber
public int getErrorNumber()
Return the raw integer value that AVPKit returned and
was used to create this IError.
Note that this value can have different meanings on
different operating systems. Use {#getType()}
instead for programmatic decisions.
- Returns:
- the native error number.
-
make
public static IError make(int errorNumber)
Create a new IError object from a return value passed in from AVPKit.
- Parameters:
errorNumber- The error number as returned from another
AVPKit call. ErrorNumber must be < 0.- Returns:
- a new IError, or null on error.
-
make
public static IError make(IError.Type type)
Create a new IError object from an IError.Type enum value.
- Parameters:
type- The type to use for creation.- Returns:
- a new IError, or null on error.
-
errorNumberToType
public static IError.Type errorNumberToType(int errorNo)
Translate an error number to a type.- Parameters:
errorNo- The error returned from AVPKit- Returns:
- the type
-
typeToErrorNumber
public static int typeToErrorNumber(IError.Type type)
Translate an a type to an error number.- Parameters:
type- The type- Returns:
- the error number
-
-