|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ipworks.Netcode
The NetCode class can be used to encode or decode files or strings. UUEncode , MIME's Base64 and Quoted-Printable , as well as URL encoding formats are currently supported.
NetCode's operation is controlled by assigning a value to the Action property. The encoding format is specified by the Format property. The binary data, or the name of the file containing binary data, is specified by the DecodedData property and the encoded data or filename is specified by the EncodedData property. The FileName property may be used to override the default file names or to specify a directory during uuencoding. After uudecoding, the FileName property contains the fully specified file name of the decoded file.
Understanding Encoding/Decoding
Most of mail systems use only 7 bits to transmit messages. A binary file such as an archive or a non-plain text formatted file produced from a text processor should be first encoded in 7 bit code before email transfer.
Decoding is the inverse process: creation of the original file from the encoded data. Encoded data are often split over several files because of the size limit placed on the email message. Each message is preceded by information about splitting and also the mail header. NetCode supports this case in both directions:
- during encoding setting the MaxFileSize property to the maximum size of a message body instructs NetCode to split the encoded data over several files. Multiple filenames can be specified by using question marks "?".
- during decoding , the body messages can be saved in separate files named namexxx.ext where xxx is a numeral starting at 000 and ext is ".uue", ".b16", or ".q_p" according to Format . This multiple filename should be given to EncodedData . While uudecoding, if the IntelliCode property is set to True, NetCode tries to filter the data that don't belong to the pure uuencoded data (also the mail header).
Field Summary | |
static int |
a_DecodeToFile
|
static int |
a_DecodeToString
|
static int |
a_EncodeToFile
|
static int |
a_EncodeToString
|
static int |
a_Idle
|
static int |
f_BASE64
|
static int |
f_QP
|
static int |
f_URL
|
static int |
f_UUEncode
|
Constructor Summary | |
Netcode()
|
Method Summary | |
void |
addNetcodeEventListener(NetcodeEventListener l)
|
void |
fireProgress(int percentDone)
Occurs when PercentDone of the input is read. |
int |
getAction()
Controls the operation of NetCode. |
byte[] |
getDecodedData()
Filename of the decoded data or the decoded data itself. |
byte[] |
getEncodedData()
Filename of the encoded data or the encoded data itself. |
int |
getFileCnt()
Shows the number of encoded files the component has read from or written into. |
java.lang.String |
getFileName()
The destination filename for the encoded data. |
int |
getFormat()
Shows the type of encoding to be used. |
int |
getMaxFileSize()
When decoding, controls whether encoded data should be split into several files and gives the maximum allowed size for these files. |
java.lang.String |
getMode()
The UNIX-style filemode when uuencoding / uudecoding. |
int |
getProgressStep()
Controls the granularity at which the Progress event is fired. |
boolean |
isIntelliCode()
Controls whether NetCode should try to interpret several concatenated messages while uudecoding. |
boolean |
isOverwrite()
Controls whether created file(s) should overwrite already existing file(s). |
void |
removeNetcodeEventListener(NetcodeEventListener l)
|
void |
setAction(int action)
Controls the operation of NetCode. |
void |
setDecodedData(byte[] decodedData)
Filename of the decoded data or the decoded data itself. |
void |
setEncodedData(byte[] encodedData)
Filename of the encoded data or the encoded data itself. |
void |
setFileName(java.lang.String fileName)
The destination filename for the encoded data. |
void |
setFormat(int format)
Shows the type of encoding to be used. |
void |
setIntelliCode(boolean intelliCode)
Controls whether NetCode should try to interpret several concatenated messages while uudecoding. |
void |
setMaxFileSize(int maxFileSize)
When decoding, controls whether encoded data should be split into several files and gives the maximum allowed size for these files. |
void |
setMode(java.lang.String mode)
The UNIX-style filemode when uuencoding / uudecoding. |
void |
setOverwrite(boolean overwrite)
Controls whether created file(s) should overwrite already existing file(s). |
void |
setProgressStep(int progressStep)
Controls the granularity at which the Progress event is fired. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int a_Idle
public static final int a_DecodeToFile
public static final int a_EncodeToFile
public static final int a_DecodeToString
public static final int a_EncodeToString
public static final int f_UUEncode
public static final int f_BASE64
public static final int f_QP
public static final int f_URL
Constructor Detail |
public Netcode()
Method Detail |
public int getAction()
The following are the possible values for the Action property and the corresponding descriptions:
public void setAction(int action) throws IPWorksException
The following are the possible values for the Action property and the corresponding descriptions:
public byte[] getDecodedData()
When decoding, the class tries to generate the name for the created file in the following order: DecodedData , FileName , or when the format is UUEncode, the specified filename in the uuencoded data itself. If DecodedData or FileName end with a backslash "\\" they are interpreted as directories and the class tries to create the given filename in this directory. If this is the case, FileName shows the name of the created file.
public void setDecodedData(byte[] decodedData) throws IPWorksException
When decoding, the class tries to generate the name for the created file in the following order: DecodedData , FileName , or when the format is UUEncode, the specified filename in the uuencoded data itself. If DecodedData or FileName end with a backslash "\\" they are interpreted as directories and the class tries to create the given filename in this directory. If this is the case, FileName shows the name of the created file.
public byte[] getEncodedData()
The class appends the extension ".uue", ".b16", or ".q_p" depending on Format immediately after the generated numbers. FileCnt contains the number of encoded files.
See also the Format , IntelliCode , and MaxFileSize properties when working with multiple files.
public void setEncodedData(byte[] encodedData) throws IPWorksException
The class appends the extension ".uue", ".b16", or ".q_p" depending on Format immediately after the generated numbers. FileCnt contains the number of encoded files.
See also the Format , IntelliCode , and MaxFileSize properties when working with multiple files.
public int getFileCnt()
Please refer to EncodedData for filename conventions.
public java.lang.String getFileName()
When decoding, if the value of the property is not empty, it shows the class where to write the decoded data. It can be either the filename or the directory where the file should be written. If a directory, it should end with a backslash "\\".
After a decode Action , the FileName property contains the filename for the created file. If the file couldn't be created because of an illegal filename, examining FileName might give a hint about the reason of the failure.
FileName must be set to "" (empty string) after each decode operation since it contains the full specification of the file.
An error occurs if FileName is empty and the UUEncode Format and the EncodeToString Action are selected.
If you want to first check the uuencoded filename before creating it on disk, you may assign an illegal directory name to FileName (always use a closing backslash "\\" to denote it as directory), then catch the exception and check the filename appended to FileName .
public void setFileName(java.lang.String fileName) throws IPWorksException
When decoding, if the value of the property is not empty, it shows the class where to write the decoded data. It can be either the filename or the directory where the file should be written. If a directory, it should end with a backslash "\\".
After a decode Action , the FileName property contains the filename for the created file. If the file couldn't be created because of an illegal filename, examining FileName might give a hint about the reason of the failure.
FileName must be set to "" (empty string) after each decode operation since it contains the full specification of the file.
An error occurs if FileName is empty and the UUEncode Format and the EncodeToString Action are selected.
If you want to first check the uuencoded filename before creating it on disk, you may assign an illegal directory name to FileName (always use a closing backslash "\\" to denote it as directory), then catch the exception and check the filename appended to FileName .
public int getFormat()
public void setFormat(int format) throws IPWorksException
public boolean isIntelliCode()
IMPORTANT: The uuencoded messages should appear in the proper order. The class handles only the filtering of packing information and does no sorting.
The IntelliCode property applies only to the 'uuencoded' Format .
public void setIntelliCode(boolean intelliCode) throws IPWorksException
IMPORTANT: The uuencoded messages should appear in the proper order. The class handles only the filtering of packing information and does no sorting.
The IntelliCode property applies only to the 'uuencoded' Format .
public int getMaxFileSize()
IMPORTANT: if a non-zero value is assigned to MaxFileSize then a multiple filename should also be assigned to EncodedData (end with question marks "?") so that the class can expand the filenames.
Please refer to the Error Messages section for a complete list of possible errors.
public void setMaxFileSize(int maxFileSize) throws IPWorksException
IMPORTANT: if a non-zero value is assigned to MaxFileSize then a multiple filename should also be assigned to EncodedData (end with question marks "?") so that the class can expand the filenames.
Please refer to the Error Messages section for a complete list of possible errors.
public java.lang.String getMode()
Given for compatibility with other systems. Used only when Format is fmtUUE.
public void setMode(java.lang.String mode) throws IPWorksException
Given for compatibility with other systems. Used only when Format is fmtUUE.
public boolean isOverwrite()
public void setOverwrite(boolean overwrite) throws IPWorksException
public int getProgressStep()
If ProgressStep is 0, the Progress event is disabled.
public void setProgressStep(int progressStep) throws IPWorksException
If ProgressStep is 0, the Progress event is disabled.
public void fireProgress(int percentDone)
NetcodeProgressEvent
public void addNetcodeEventListener(NetcodeEventListener l) throws java.util.TooManyListenersException
public void removeNetcodeEventListener(NetcodeEventListener l)
|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |