|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Converter
Converts values between primitive types. The conversion will typically be like a typecast, though conversions involving scaling or other functions may equally be provided. A given Converter object converts, in both directions, between two primitive types which are labelled 1 and 2. Bad value processing is part of the interface; a bad value at the input end of the conversion will result in a bad value at the output end, and a non-bad value at the input end may result in a bad value at the output end, for instance in the case of overflow.
Method Summary | |
---|---|
void |
convert12(Object src1,
int srcPos,
Object dest2,
int destPos,
int length)
Converts a sequence of values of type 1 to a sequence of values of type 2. |
void |
convert21(Object src2,
int srcPos,
Object dest1,
int destPos,
int length)
Converts a sequence of values of type 2 to a sequence of values of type 1. |
BadHandler |
getBadHandler1()
Returns the bad value handler used for type 1. |
BadHandler |
getBadHandler2()
Returns the bad value handler used for type 2. |
Type |
getType1()
Returns the data type of type 1. |
Type |
getType2()
Returns the data type of type 2. |
boolean |
isUnit12()
Indicates whether conversion from type 1 to type 2 does any work. |
boolean |
isUnit21()
Indicates whether conversion from type 2 to type 1 does any work. |
Method Detail |
---|
Type getType1()
Type getType2()
BadHandler getBadHandler1()
BadHandler getBadHandler2()
boolean isUnit12()
boolean isUnit21()
void convert12(Object src1, int srcPos, Object dest2, int destPos, int length)
src1
- the source array, which must be an array of
primitive type 1 with at least srcPos+length elementssrcPos
- the position in the source array of the first element
to be converteddest2
- the destination array, which must be an array of
primitive type 2 with at least destPos+length elements.
If type 1 and type 2 are the same, it is permissible
for src1 and dest2 to be references to the same objectdestPos
- the position in the destination array at which the
first converted element will be writtenlength
- the number of elements to convert
IndexOutOfBoundsException
- if access outside the bounds of the
source or destination array is
attemptedvoid convert21(Object src2, int srcPos, Object dest1, int destPos, int length)
src2
- the source array, which must be an array of
primitive type 2 with at least srcPos+length elementssrcPos
- the position in the source array of the first element
to be converteddest1
- the destination array, which must be an array of
primitive type 1 with at least destPos+length elements.
If type 1 and type 2 are the same, it is permissible
for src2 and dest1 to be references to the same objectdestPos
- the position in the destination array at which the
first converted element will be writtenlength
- the number of elements to convert
IndexOutOfBoundsException
- if access outside the bounds of the
source or destination array is
attempted
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |