com.ibm.wbi
Class MarkPreservedException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.io.IOException
                    |
                    +--com.ibm.wbi.MarkPreservedException
All Implemented Interfaces:
java.io.Serializable

public class MarkPreservedException
extends java.io.IOException

MarkPreservedException is thrown by MegInputStream.read() whenever a read is attempted on a marked, preserved stream and the read would exceed the readlimit supplied to mark(). The mark is left intact. This is useful when you want to mark a stream so you can reject a request later, but you don't have direct control over how many bytes are read from the stream. If too many bytes are read, the mark will become invalid and you won't be able to reject the request anymore. Here is an example:

 void handleRequest(RequestEvent e) throws RequestRejectedException {
   MegInputStream in = e.getMegInputStream();
   MegOutputStream out = e.getMegOutputStream();
   HtmlEditor ed = new HtmlEditor(in, out);
   // Look for a  tag, but if it's not found in the first
   // 10k, you really don't want to deal with this document anyway.
   in.mark(10000);
   in.preserveMark();
   HtmlItem item;
   try {
     item = ed.readUntil("TITLE");
   } catch (MarkPreservedException mpe) {
     // This happens if ed.readUntil() tries to read more than 10000
     // bytes.  If preserveMark() had not been called, the
     // HtmlEditor would keep reading, the mark would become
     // invalid, and you would not be able to reject the request
     // anymore.
     throw new RequestRejectedException("No <TITLE> in first 10k");
   }
   // If it did find the tag, now you have it here in "item".
 }
<P>
<DL>
<DT><B>See Also: </B><DD><A HREF="../../../serialized-form.html#com.ibm.wbi.MarkPreservedException">Serialized Form</A></DL>
<HR>

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


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


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

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../com/ibm/wbi/MarkPreservedException.html#MarkPreservedException()">MarkPreservedException</A></B>()</CODE>

<BR>
           </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../com/ibm/wbi/MarkPreservedException.html#MarkPreservedException(java.lang.String)">MarkPreservedException</A></B>(java.lang.String msg)</CODE>

<BR>
           </TD>
</TR>
</TABLE>
 
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="methods_inherited_from_class_java.lang.Throwable"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Throwable</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>fillInStackTrace, getLocalizedMessage, getMessage, printStackTrace, printStackTrace, printStackTrace, toString</CODE></TD>
</TR>
</TABLE>
 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
 
<P>

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


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

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

<A NAME="MarkPreservedException()"><!-- --></A><H3>
MarkPreservedException</H3>
<PRE>
public <B>MarkPreservedException</B>()</PRE>
<DL>
</DL>
<HR>

<A NAME="MarkPreservedException(java.lang.String)"><!-- --></A><H3>
MarkPreservedException</H3>
<PRE>
public <B>MarkPreservedException</B>(java.lang.String msg)</PRE>
<DL>
</DL>

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

<!-- ========= END OF CLASS DATA ========= -->
<HR>

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev">  <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
 PREV CLASS 
 <A HREF="../../../com/ibm/wbi/MegException.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>   
 <A HREF="MarkPreservedException.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:  INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#methods_inherited_from_class_java.lang.Throwable">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:  FIELD | <A HREF="#constructor_detail">CONSTR</A> | METHOD</FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>

</BODY>
</HTML>