com.xuggle.xuggler
Class IError

Package class diagram package IError
java.lang.Object
  extended by com.xuggle.ferry.RefCounted
      extended by com.xuggle.xuggler.IError

public class IError
extends RefCounted

Maps from int return codes to defined Error values.

This class is used to map from Xuggler return codes (for example on IContainer.readNextPacket(IPacket)

WARNING: Do not write code that depends on the integer values returned from Xuggler; 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
static class IError.Type
           
 
Field Summary
 
Fields inherited from class com.xuggle.ferry.RefCounted
swigCMemOwn
 
Constructor Summary
protected IError(long cPtr, boolean cMemoryOwn)
          Internal Only.
protected IError(long cPtr, boolean cMemoryOwn, AtomicLong ref)
          Internal Only.
 
Method Summary
 IError copyReference()
          Create a new IError object that is actually referring to the exact same underlying native object.
 boolean equals(Object obj)
          Compares two values, returning true if the underlying objects in native code are the same object.
static IError.Type errorNumberToType(int errorNo)
          Translate an error number to a type.
static long getCPtr(IError obj)
          Internal Only.
 String getDescription()
          Get a text description for this error.
 int getErrorNumber()
          Return the raw integer value that Xuggler returned and was used to create this IError.
 long getMyCPtr()
          Internal Only.
 IError.Type getType()
          Get the OS-independent Xuggler type for this error.
 int hashCode()
          Get a hashable value for this object.
static IError make(IError.Type type)
          Create a new IError object from an IError.Type enum value.
static IError make(int errorNumber)
          Create a new IError object from a return value passed in from Xuggler.
 String toString()
          Return a string representation of this error
static int typeToErrorNumber(IError.Type type)
          Translate an a type to an error number.
 
Methods inherited from class com.xuggle.ferry.RefCounted
acquire, delete, getCPtr, getCurrentRefCount, getJavaRefCount, release
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IError

protected IError(long cPtr,
                 boolean cMemoryOwn)
Internal Only.


IError

protected IError(long cPtr,
                 boolean cMemoryOwn,
                 AtomicLong ref)
Internal Only.

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:
getMyCPtr in class RefCounted
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:
copyReference in class RefCounted
Returns:
the new Java object.

equals

public boolean equals(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:
equals in class 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:
hashCode in class Object
Returns:
the hashable value.

toString

public String toString()
Return a string representation of this error

Overrides:
toString in class Object
Returns:
the error as a string

getType

public IError.Type getType()
Get the OS-independent Xuggler type for this error.

Returns:
the type.

getDescription

public 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 Xuggler 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 Xuggler.

Parameters:
errorNumber - The error number as returned from another Xuggler 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 Xuggler
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


Copyright © 2008, 2010 Xuggle