Interface CabDecoderInterface
public interface CabDecoderInterface extends CabProgressInterface
{
// Methods
boolean closeOutputStream(OutputStream stream,
CabFileEntry entry, boolean success);
InputStream openCabinet(String disk_name, String cabinet_name);
OutputStream openOutputStream(CabFileEntry entry);
boolean reservedAreaData(int reserve_type, byte[] reserved_data,
int reserved_data_size, byte[] other_data,
int other_data_size );
}
This is the interface that must be passed as a parameter to the CabDecoder constructor.
For more information about cabinet file decoding, see CabDecoderand CabFileEntry.
CabProgressInterface
|
+--CabDecoderInterface
boolean closeOutputStream(OutputStream stream, CabFileEntry entry,
boolean success);
closeOutputStream is guaranteed to be called to close a stream opened using openOutputStream.
Return Value:
Returns true if processing should continue for files in this cabinet, or false if processing should end immediately. In the latter case, no more openOutputStream calls will be made.
Parameter | Description |
stream
| A handle on the file extracted from the cabinet file.
|
entry
| Contains information about the file extracted from the cabinet file.
|
success
| Determines whether the file was extracted successfully. If the value of this parameter is false, then all of the data written to this stream must be considered invalid.
|
InputStream openCabinet(String disk_name, String cabinet_name);
This method is used to open a next or previous cabinet in a set of spanned cabinets. Since spanned cabinets are currently not supported in this version of the cabinet file package, this method will never be called.
Return Value:
Returns null if the specified cabinet file is not available; otherwise an InputStream for the specified cabinet file is returned.
Parameter | Description |
disk_name
| The disk name of the desired cabinet file.
|
cabinet_name
| The cabinet name of the desired cabinet file.
|
OutputStream openOutputStream(CabFileEntry entry);
After the CabDecoder.extract method is called, the openStream method will be called for each file entry in the cabinet file.
Return Value:
Returns either an OutputStream object from which to extract the file, or null, indicating that the file should not be extracted.
Parameter | Description |
entry
| The CabFileEntry that will be extracted. The contents of this object are examined to determine whether it should be extracted.
|
boolean reservedAreaData(int reserve_type, byte[] reserved_data,
int reserved_data_size, byte[] other_data, int other_data_size );
Called when the cabinet file contains reserved data. If the cabinet file does not contain any reserved data, then this method will never be called.
The reserve_type and data_size parameters indicate the type of reserved area (as defined in the CabConstants interface) and the size of the area. The data parameter will be null.
This method returns true to indicate that reserved areas of the specified type should be read, or false to indicate that they should be ignored. In the former case, reservedAreaData will be invoked each time the specified reserve area is seen with data containing the reserved data.
- Additional reserved data area
- Applications that use this method should return false for any reserved area types that they do not know how to handle.
Return Value:
Returns true if this type of reserved entry should be read and passed back for subsequent calls to this method, or false if no more calls should be made for this type of reserved data.
Parameter | Description |
reserve_type
| Type of reserved area as defined in the CabConstants interface.
|
reserved_data
| The array containing the reserved data, or null if this is only a message indicating that the reserved area exists.
|
reserved_data_size
| Size of the reserved area, or zero if size is not known
|
other_data
| Valid only if a RESERVED_CFDATA type, in which case this array contains the data in the CFDATA frame
|
other_data_size
| Valid only if a RESERVED_CFDATA reserve type, in which case this is the size of the data in other_data[]
|