org.apache.james.mailbox
Interface Content

All Known Subinterfaces:
MessageResult.Header

public interface Content

IMAP needs to know the size of the content before it starts to write it out. This interface allows direct writing whilst exposing total size.


Method Summary
 long size()
          Size (in octets) of the content.
 void writeTo(java.nio.channels.WritableByteChannel channel)
          Writes content to the given channel.
 

Method Detail

writeTo

void writeTo(java.nio.channels.WritableByteChannel channel)
             throws java.io.IOException
Writes content to the given channel. Be aware that this operation may only be called once one the content because its possible dispose temp data. If you need to write the content more then one time you should "re-create" the content

Parameters:
channel - Channel open, not null
Throws:
MailboxException
java.io.IOException - when channel IO fails

size

long size()
Size (in octets) of the content.

Returns:
number of octets to be written
Throws:
javax.mail.MessagingException


Copyright © 2002-2010 The Apache Software Foundation. All Rights Reserved.