|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Canonicalizer
Interface to be implemented for providing a special canonicalization scheme.
IAIK-S/MIME itself implements this interface with the DefaultCanonicalizer
only
ensuring that <CR> and <LF> always occurs together as
<CR><LF> except when binary content transfer encoding is used.
An application having or wishing to use a more specific canonicalization
scheme may implement this interface and register its new Canonicalizer
by calling the static setCanonicalizer
method of the SMimeParameters
class.
Note that for outging messages the Canonicalizer only is visited when
modelling body parts and multiparts by classes SMimeBodyPart
and SMimeMultipart
classes or when supplying
a text message by means of method setText
for a
multipart/signed SignedContent
object. When parsing an ingoing message the canonicalizer only is
utilized for the contents part of a multipart/signed message.
DefaultCanonicalizer
Method Summary | |
---|---|
java.io.InputStream |
canonicalizeInputStream(LineInputStream is,
java.lang.String boundary)
Wraps an canonicalizing input stream around the given input stream This method may be implemented for applying a special canonicalization scheme to the MIME entity read from the given input stream. |
java.io.OutputStream |
canonicalizeOutputStream(java.io.OutputStream os,
java.lang.String contentType,
java.lang.String contentTransferEncoding)
Wraps an canonicalizing output stream around the given output stream. |
Method Detail |
---|
java.io.OutputStream canonicalizeOutputStream(java.io.OutputStream os, java.lang.String contentType, java.lang.String contentTransferEncoding) throws java.io.IOException
os
- the (buffered) output stream where the MIME body part shall be written.contentType
- the MIME content type of the body part to be writtencontentTransferEncoding
- the content transfer encoding of the body part
to be written.
java.io.IOException
- if an error has to be thrown when setting the
canonicalizing wrapping streamjava.io.InputStream canonicalizeInputStream(LineInputStream is, java.lang.String boundary) throws java.io.IOException
The input stream is an iaik.utils.LineInputStream
allowing to
use method readLine
for parsing the MIME entity line by line
from the given stream. The boundary
parameter indicates the
boundary line belonging to the MIME entity read from the stream. When
implementing this method for canonicalizing the MIME entity the stream
shall be read only until it reaches the given boundary line, e.g.:
public class MyCanonicalizeInputStream extends FilterInputStream { private String boundary; ... // constructor: public MyCanonicalizeInputStream(LineInputStream in, String boundary) { super(in); this.boundary = "--" + boundary; } ... public int read(byte b[], int off, int len) throws IOException { ... String line = ((LineInputStream)in).readLine(); if( (line == null) || line.equals(boundary) ) { // stop processing return -1; } } ... } // And now implement the Canonicalizer: public class MyCanonicalizer implements Canonicalizer { ... public OutputStream canonicalizeOutputStream(OutputStream os, String contentType, String contentTransferEncoding) { ... } public InputStream canonicalizeInputStream(LineInputStream is, String boundary) { return new MyCanonicalizeInputStream(is, boundary); } }
is
- the input stream representing the MIME entity to be canonicalizedboundary
- the boundary line indicating the end of the MIME entity
java.io.IOException
- if an error has to be thrown when setting the
canonicalizing wrapping stream
|
This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |