net.rim.device.api.io.parser
Class GUNZIPMessageProcessor

java.lang.Object
  extended by net.rim.device.api.io.parser.GUNZIPMessageProcessor
All Implemented Interfaces:
ChainableMessageProcessor, MessageProcessor

public class GUNZIPMessageProcessor
extends Object
implements ChainableMessageProcessor

This MessageProcessor unzips the body of a Message and updates the body with the uncompressed version. It works on byte arrays and InputStream objects. The process method de-compresses an entire byte array and stores the result as a byte array. The chain method updates the InputStream with the Message object's body and wraps it with a GZIPInputStream. This allows the bytes in the stream to be un-zipped on the fly as they are read by an application.

Since:
BlackBerry API 6.0.0

Constructor Summary
GUNZIPMessageProcessor()
          Constructs a GUNZIPMessageProcessor.
 
Method Summary
 InputStream chain(InputStream stream)
          Wraps the InputStream specified with a GZIPInputStream.
 void process(Message message)
          Reads the body of a Message, unzips the data, and updates the body of the message with the resulting de-compressed data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

GUNZIPMessageProcessor

public GUNZIPMessageProcessor()
Constructs a GUNZIPMessageProcessor.

Since:
BlackBerry API 6.0.0


Method Detail

process

public void process(Message message)
             throws MessageProcessorException
Reads the body of a Message, unzips the data, and updates the body of the message with the resulting de-compressed data. If the message body is very large, you should use the chain method instead.

Specified by:
process in interface MessageProcessor
Parameters:
message - Message to process.
Throws:
MessageProcessorException - If any problems occur during the unzipping process.
Since:
BlackBerry API 6.0.0

chain

public InputStream chain(InputStream stream)
Wraps the InputStream specified with a GZIPInputStream. It can be used to update a Message objects's body InputStream with one that un-zips the message body as the bytes are read from the stream. This is the preferred approach if the message body is large.

Specified by:
chain in interface ChainableMessageProcessor
Parameters:
stream - InputStream to wrap.
Returns:
InputStream that un-zips the original InputStream.
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal