C# Class Summer.Batch.Extra.Ebcdic.Encode.EbcdicEncoder

Encode C# objects to EBCDIC
Afficher le fichier Open project: SummerBatch/SummerBatch Class Usage Examples

Méthodes publiques

Méthode Description
EbcdicEncoder ( Encoding encoding ) : System

Custom constructor using encoding

EbcdicEncoder ( string encodingName ) : System

Custom constructor using encoding name

Encode ( object field, Summer.Batch.Extra.Copybook.FieldFormat fieldFormat ) : byte[]

Encodes a C# object to a byte array using EBCDIC format. Main method.

EncodePacked ( decimal value, int size ) : byte[]

Encodes a decimal as a packed number, using defaults.

EncodePacked ( decimal value, int size, int nbDecimals, bool signed ) : byte[]

Encodes a decimal as a packed number.

EncodeZoned ( decimal value, int size ) : string

Encode decimal as zoned number, using defaults.

EncodeZoned ( decimal value, int size, int nbDecimals, bool signed, bool impliedDecimal ) : string

Encode decimal as zoned number.

Private Methods

Méthode Description
EncodeBinary ( object field, Summer.Batch.Extra.Copybook.FieldFormat fieldFormat ) : byte[]

Encode decimal to binary. Only accept decimal or throw ValueTypeMismatchException.

EncodePacked ( object field, Summer.Batch.Extra.Copybook.FieldFormat fieldFormat ) : byte[]

Encode objet as packed number

EncodeText ( object field, Summer.Batch.Extra.Copybook.FieldFormat fieldFormat ) : byte[]

Encode object as text, using current encoding

EncodeTransparent ( object field, Summer.Batch.Extra.Copybook.FieldFormat fieldFormat ) : byte[]

Encode given object in a transparent way. Only applies to existing byte array having correct length. All other situations will lead to throwing a ValueTypeMismatchException.

EncodeZoned ( object field, Summer.Batch.Extra.Copybook.FieldFormat fieldFormat ) : byte[]

Encode object as zoned number.

GetByte ( DefaultValue defaultValue, Encoding encoding ) : byte

return byte given default value and using given encoding

GetNextDigit ( string number, int &index ) : byte

get next digit from a string representing a number

GetScale ( decimal dec ) : int

return the number of decimals of a given decimal. Trailing zeros are to be kept into account.

GetUnscaledValue ( decimal dec ) : decimal

return unscaled value from decimal

GetUnscaledValueAsByteArray ( decimal dec ) : byte[]

Return a significant byte array of unscaled decimal value

GetValueTypeMismatchException ( object field, Summer.Batch.Extra.Copybook.FieldFormat fieldFormat, string expectedType ) : ValueTypeMismatchException

Construct a dedicated ValueTypeMismatchException based on given inputs

SetScale ( decimal dec, int scale ) : decimal

Method Details

EbcdicEncoder() public méthode

Custom constructor using encoding
public EbcdicEncoder ( Encoding encoding ) : System
encoding System.Text.Encoding
Résultat System

EbcdicEncoder() public méthode

Custom constructor using encoding name
public EbcdicEncoder ( string encodingName ) : System
encodingName string
Résultat System

Encode() public méthode

Encodes a C# object to a byte array using EBCDIC format. Main method.
 if the object to encode is not of the expected type  if the type field is unknown or unsupported
public Encode ( object field, Summer.Batch.Extra.Copybook.FieldFormat fieldFormat ) : byte[]
field object the object to encode
fieldFormat Summer.Batch.Extra.Copybook.FieldFormat the format of the field
Résultat byte[]

EncodePacked() public static méthode

Encodes a decimal as a packed number, using defaults.
public static EncodePacked ( decimal value, int size ) : byte[]
value decimal
size int
Résultat byte[]

EncodePacked() public static méthode

Encodes a decimal as a packed number.
public static EncodePacked ( decimal value, int size, int nbDecimals, bool signed ) : byte[]
value decimal
size int
nbDecimals int
signed bool
Résultat byte[]

EncodeZoned() public static méthode

Encode decimal as zoned number, using defaults.
public static EncodeZoned ( decimal value, int size ) : string
value decimal
size int
Résultat string

EncodeZoned() public static méthode

Encode decimal as zoned number.
public static EncodeZoned ( decimal value, int size, int nbDecimals, bool signed, bool impliedDecimal ) : string
value decimal
size int
nbDecimals int
signed bool
impliedDecimal bool
Résultat string