<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2) on Tue Oct 02 23:24:48 BST 2012 -->
<TITLE>
MqttPersistable (MQTT v3 Client API)
</TITLE>

<META NAME="keywords" CONTENT="org.eclipse.paho.client.mqttv3.MqttPersistable interface">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="MqttPersistable (MQTT v3 Client API)";
}
</SCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<A HREF="#main"><FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/MqttPersistable.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../serialized-form.html"><FONT CLASS="NavBarFont1"><B>Serialized</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttDeliveryToken.html" title="interface in org.eclipse.paho.client.mqttv3"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="MqttPersistable.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>

</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<A NAME="main"></A>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.eclipse.paho.client.mqttv3</FONT>
<BR>
Interface MqttPersistable</H2>
<HR>
<DL>
<DT>public interface <B>MqttPersistable</B></DL>

<P>
Represents an object used to pass data to be persisted across the
 <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttClientPersistence.html" title="interface in org.eclipse.paho.client.mqttv3"><CODE>MqttClientPersistence</CODE></A>
 interface.
 <p>
 When data is passed across the interface the header and payload are 
 separated, so that unnecessary message copies may be avoided.
 For example, if a 10 MB payload was published it would be inefficient
 to create a byte array a few bytes larger than 10 MB and copy the
 MQTT message header and payload into a contiguous byte array.</p>
 <p>
 When the request to persist data is made a separate byte array and offset
 is passed for the header and payload. Only the data between
 offset and length need be persisted.
 So for example, a message to be persisted consists of a header byte
 array starting at offset 1 and length 4, plus a payload byte array
 starting at offset 30 and length 40000. There are three ways in which
 the persistence implementation may return data to the client on
 recovery:
 <ul>
 <li>It could return the data as it was passed in
 originally, with the same byte arrays and offsets.</li>
 <li>It could safely just persist and return the bytes from the offset
 for the specified length. For example, return a header byte array with
 offset 0 and length 4, plus a payload byte array with offset 0 and length
 40000</li>
 <li>It could return the header and payload as a contiguous byte array
 with the header bytes preceeding the payload. The contiguous byte array
 should be set as the header byte array, with the payload byte array being
 null. For example, return a single byte array with offset 0 
 and length 40004.
 This is useful when recovering from a file where the header and payload
 could be written as a contiguous stream of bytes.</li>
 </ul>
 </p>
<P>

<P>
<HR>

<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->


<!-- ======== CONSTRUCTOR SUMMARY ======== -->


<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getHeaderBytes()">getHeaderBytes</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the header bytes in an array.
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getHeaderLength()">getHeaderLength</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the length of the header.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getHeaderOffset()">getHeaderOffset</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the offset of the header within the byte array returned by <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getHeaderBytes()"><CODE>getHeaderBytes()</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getPayloadBytes()">getPayloadBytes</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the payload bytes in an array.
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getPayloadLength()">getPayloadLength</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the length of the payload.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getPayloadOffset()">getPayloadOffset</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the offset of the payload within the byte array returned by <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getPayloadBytes()"><CODE>getPayloadBytes()</CODE></A>.</TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->


<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="getHeaderBytes()"><!-- --></A><H3>
getHeaderBytes</H3>
<PRE>
public byte[] <B>getHeaderBytes</B>()
                      throws <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></PRE>
<DL>
<DD>Returns the header bytes in an array.
 The bytes start at <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getHeaderOffset()"><CODE>getHeaderOffset()</CODE></A>
 and continue for <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getHeaderLength()"><CODE>getHeaderLength()</CODE></A>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the header bytes.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="getHeaderLength()"><!-- --></A><H3>
getHeaderLength</H3>
<PRE>
public int <B>getHeaderLength</B>()
                    throws <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></PRE>
<DL>
<DD>Returns the length of the header.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the header length
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="getHeaderOffset()"><!-- --></A><H3>
getHeaderOffset</H3>
<PRE>
public int <B>getHeaderOffset</B>()
                    throws <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></PRE>
<DL>
<DD>Returns the offset of the header within the byte array returned by <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getHeaderBytes()"><CODE>getHeaderBytes()</CODE></A>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the header offset.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="getPayloadBytes()"><!-- --></A><H3>
getPayloadBytes</H3>
<PRE>
public byte[] <B>getPayloadBytes</B>()
                       throws <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></PRE>
<DL>
<DD>Returns the payload bytes in an array.
 The bytes start at <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getPayloadOffset()"><CODE>getPayloadOffset()</CODE></A>
 and continue for <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getPayloadLength()"><CODE>getPayloadLength()</CODE></A>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the payload bytes.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="getPayloadLength()"><!-- --></A><H3>
getPayloadLength</H3>
<PRE>
public int <B>getPayloadLength</B>()
                     throws <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></PRE>
<DL>
<DD>Returns the length of the payload.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the payload length.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="getPayloadOffset()"><!-- --></A><H3>
getPayloadOffset</H3>
<PRE>
public int <B>getPayloadOffset</B>()
                     throws <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></PRE>
<DL>
<DD>Returns the offset of the payload within the byte array returned by <A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistable.html#getPayloadBytes()"><CODE>getPayloadBytes()</CODE></A>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the payload offset.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttPersistenceException.html" title="class in org.eclipse.paho.client.mqttv3">MqttPersistenceException</A></CODE></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<A HREF="#main"><FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/MqttPersistable.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../serialized-form.html"><FONT CLASS="NavBarFont1"><B>Serialized</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/eclipse/paho/client/mqttv3/MqttDeliveryToken.html" title="interface in org.eclipse.paho.client.mqttv3"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="MqttPersistable.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>

</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

</BODY>
</HTML>