gecko-dev/grendel/docs/calypso/util/CacheOutputStream.html

655 lines
23 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Sun Aug 01 23:07:06 MDT 1999 -->
<TITLE>
: Class CacheOutputStream
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> &nbsp;<FONT ID="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../help-doc.html"><FONT ID="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" ID="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../calypso/util/ByteToCharConverterEnumeration.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../calypso/util/CharArray.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="CacheOutputStream.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
calypso.util</FONT>
<BR>
Class CacheOutputStream</H2>
<PRE>
java.lang.Object
|
+--java.io.OutputStream
|
+--<B>calypso.util.CacheOutputStream</B>
</PRE>
<HR>
<DL>
<DT>public class <B>CacheOutputStream</B><DT>extends java.io.OutputStream</DL>
<P>
This class provides buffering for arbitrarily large streams of data.
It is an <TT>OutputStream</TT>, so you just write the data you want to
cache to it. Then, when you've written all of your data (and called
<TT>close()</TT>) you can get the data back by calling
<TT>makeInputStream()</TT>, which returns an <TT>InputStream</TT>.
<P> If you decide you don't want the data at all, you should call
<TT>discardBuffer()</TT> as early as possible, to avoid having a temporary
file stay around longer than necessary. It's not necessary to call
<TT>discardBuffer()</TT> if you have called <TT>makeInputStream()</TT>;
it is called automatically when that stream is closed. However, it is
ok to call <TT>discardBuffer()</TT> than once.
<P> So, one conservative way of using this would be:
<UL>
<TT>CacheOutputStream output = new CacheOutputStream();</TT><BR>
<TT>try {</TT><BR>
<TT>&nbsp;&nbsp;</TT><I>... write bytes to `output' ...</I><BR>
<TT>&nbsp;&nbsp;output.close();</TT><BR>
<BR>
<TT>&nbsp;&nbsp;InputStream input = output.makeInputStream();</TT><BR>
<TT>&nbsp;&nbsp;try {</TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;</TT><I>... read bytes from `input' ...</I>
<BR>
<TT>&nbsp;&nbsp;} finally {</TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;input.close();</TT><BR>
<TT>&nbsp;&nbsp;}</TT><BR>
<BR>
<TT>} finally {</TT><BR>
<TT>&nbsp;&nbsp;output.discardBuffer();</TT><BR>
<TT>}</TT></PRE></UL><P>
<DL><DT>Implementation:</DT><DD>
<P> The bytes written to the stream are buffered in memory, until
a size threshold is reached, or a memory-allocation error occurs.
At that point, a temporary file is created, and buffering continues
there. Therefore, files are not used for small objects; this ensures
that buffering of small objects is fast, but buffering of arbitrarily
large objects is possible.
</DL>
<P>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;java.lang.Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#bs_handle">bs_handle</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;java.io.OutputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#bs_stream">bs_stream</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#mem_cache">mem_cache</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#mem_cache_fp">mem_cache_fp</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#mem_cache_increment">mem_cache_increment</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#mem_cache_max_size">mem_cache_max_size</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#CacheOutputStream()">CacheOutputStream</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a CacheOutputStream with default buffer sizes.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#CacheOutputStream(int)">CacheOutputStream</A></B>(int&nbsp;max_resident_size)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a CacheOutputStream with the given maximum memory usage.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#CacheOutputStream(int, int)">CacheOutputStream</A></B>(int&nbsp;probable_size,
int&nbsp;max_resident_size)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a CacheOutputStream with the given initial memory buffer size,
and given maximum memory usage.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#close()">close</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Indicate (only) that no more data will be written in to the buffer.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;java.io.InputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#createBackingStoreInputStream()">createBackingStoreInputStream</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assuming backing-store is in use, creates an InputStream that reads
from the underlying TempFile, and will call this.discardBuffer()
when that InputStream reaches EOF.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#discardBackingStore()">discardBackingStore</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assuming backing-store is in use, delete the underlying temp file.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#discardBuffer()">discardBuffer</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call this when you're done with this object.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#finalize()">finalize</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Calls discardBuffer(), in case this object was dropped without being
properly shut down.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#flush()">flush</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#growMemCache(int)">growMemCache</A></B>(int&nbsp;count)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assuming the memory cache is in use, expand the mem_cache to be
able to hold an additional `count' bytes if necessary.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#increaseCapacity(int)">increaseCapacity</A></B>(int&nbsp;count)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure that there is room to write an additonal `count' bytes.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.io.InputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#makeInputStream()">makeInputStream</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an InputStream that returns the data previously written
into this object.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#switchToBackingStore()">switchToBackingStore</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assuming the memory cache is in use, switch to using the disk cache.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#write(byte[])">write</A></B>(byte[]&nbsp;bytes)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#write(byte[], int, int)">write</A></B>(byte[]&nbsp;bytes,
int&nbsp;start,
int&nbsp;length)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../calypso/util/CacheOutputStream.html#write(int)">write</A></B>(int&nbsp;b)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" ID="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE>clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="mem_cache"><!-- --></A><H3>
mem_cache</H3>
<PRE>
protected byte[] <B>mem_cache</B></PRE>
<DL>
</DL>
<HR>
<A NAME="mem_cache_fp"><!-- --></A><H3>
mem_cache_fp</H3>
<PRE>
protected int <B>mem_cache_fp</B></PRE>
<DL>
</DL>
<HR>
<A NAME="mem_cache_max_size"><!-- --></A><H3>
mem_cache_max_size</H3>
<PRE>
protected int <B>mem_cache_max_size</B></PRE>
<DL>
</DL>
<HR>
<A NAME="mem_cache_increment"><!-- --></A><H3>
mem_cache_increment</H3>
<PRE>
protected double <B>mem_cache_increment</B></PRE>
<DL>
</DL>
<HR>
<A NAME="bs_handle"><!-- --></A><H3>
bs_handle</H3>
<PRE>
protected java.lang.Object <B>bs_handle</B></PRE>
<DL>
</DL>
<HR>
<A NAME="bs_stream"><!-- --></A><H3>
bs_stream</H3>
<PRE>
protected java.io.OutputStream <B>bs_stream</B></PRE>
<DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="CacheOutputStream()"><!-- --></A><H3>
CacheOutputStream</H3>
<PRE>
public <B>CacheOutputStream</B>()</PRE>
<DL>
<DD>Creates a CacheOutputStream with default buffer sizes.</DL>
<HR>
<A NAME="CacheOutputStream(int)"><!-- --></A><H3>
CacheOutputStream</H3>
<PRE>
public <B>CacheOutputStream</B>(int&nbsp;max_resident_size)</PRE>
<DL>
<DD>Creates a CacheOutputStream with the given maximum memory usage.
If an attempt is made to buffer more than the specified number of
bytes, then the memory buffer will be traded for a disk buffer.</DL>
<HR>
<A NAME="CacheOutputStream(int, int)"><!-- --></A><H3>
CacheOutputStream</H3>
<PRE>
public <B>CacheOutputStream</B>(int&nbsp;probable_size,
int&nbsp;max_resident_size)</PRE>
<DL>
<DD>Creates a CacheOutputStream with the given initial memory buffer size,
and given maximum memory usage.
If an attempt is made to buffer more than the specified number of
bytes, then the memory buffer will be traded for a disk buffer.</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="write(byte[])"><!-- --></A><H3>
write</H3>
<PRE>
public void <B>write</B>(byte[]&nbsp;bytes)
throws java.io.IOException</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD>write in class java.io.OutputStream</DL>
</DD>
</DL>
<HR>
<A NAME="write(byte[], int, int)"><!-- --></A><H3>
write</H3>
<PRE>
public void <B>write</B>(byte[]&nbsp;bytes,
int&nbsp;start,
int&nbsp;length)
throws java.io.IOException</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD>write in class java.io.OutputStream</DL>
</DD>
</DL>
<HR>
<A NAME="write(int)"><!-- --></A><H3>
write</H3>
<PRE>
public void <B>write</B>(int&nbsp;b)
throws java.io.IOException</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD>write in class java.io.OutputStream</DL>
</DD>
</DL>
<HR>
<A NAME="close()"><!-- --></A><H3>
close</H3>
<PRE>
public void <B>close</B>()
throws java.io.IOException</PRE>
<DL>
<DD>Indicate (only) that no more data will be written in to the buffer.
After calling <TT>close()</TT>, one must eventually call either
<TT>makeInputStream()</TT> or <TT>discardBuffer()</TT>.<DD><DL>
<DT><B>Overrides:</B><DD>close in class java.io.OutputStream</DL>
</DD>
</DL>
<HR>
<A NAME="flush()"><!-- --></A><H3>
flush</H3>
<PRE>
public void <B>flush</B>()
throws java.io.IOException</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD>flush in class java.io.OutputStream</DL>
</DD>
</DL>
<HR>
<A NAME="increaseCapacity(int)"><!-- --></A><H3>
increaseCapacity</H3>
<PRE>
protected void <B>increaseCapacity</B>(int&nbsp;count)
throws java.io.IOException</PRE>
<DL>
<DD>Ensure that there is room to write an additonal `count' bytes.
If this would exceed the memory cache size, set up the disk cache.</DL>
<HR>
<A NAME="growMemCache(int)"><!-- --></A><H3>
growMemCache</H3>
<PRE>
protected void <B>growMemCache</B>(int&nbsp;count)
throws java.io.IOException</PRE>
<DL>
<DD>Assuming the memory cache is in use, expand the mem_cache to be
able to hold an additional `count' bytes if necessary.</DL>
<HR>
<A NAME="discardBuffer()"><!-- --></A><H3>
discardBuffer</H3>
<PRE>
public void <B>discardBuffer</B>()</PRE>
<DL>
<DD>Call this when you're done with this object.
It's important that you call this if you're not planning on calling
makeInputStream(); if you don't, a temp file could stay around longer
than necessary.
<P> You must not use this CacheOutputStream object after having called
discardBuffer().
<P> If you call makeInputStream(), you must not call discardBuffer()
before you are finished with the returned stream.</DL>
<HR>
<A NAME="makeInputStream()"><!-- --></A><H3>
makeInputStream</H3>
<PRE>
public java.io.InputStream <B>makeInputStream</B>()
throws java.io.IOException,
java.io.FileNotFoundException</PRE>
<DL>
<DD>Returns an InputStream that returns the data previously written
into this object. This may only be called once, and only after
<TT>close()</TT> has been called. It is also important that the
returned InputStream be closed when the caller is done with it;
failure to do so could cause a temp file to stay around longer
than necessary.</DL>
<HR>
<A NAME="finalize()"><!-- --></A><H3>
finalize</H3>
<PRE>
protected void <B>finalize</B>()</PRE>
<DL>
<DD>Calls discardBuffer(), in case this object was dropped without being
properly shut down.<DD><DL>
<DT><B>Overrides:</B><DD>finalize in class java.lang.Object</DL>
</DD>
</DL>
<HR>
<A NAME="switchToBackingStore()"><!-- --></A><H3>
switchToBackingStore</H3>
<PRE>
protected void <B>switchToBackingStore</B>()
throws java.io.IOException</PRE>
<DL>
<DD>Assuming the memory cache is in use, switch to using the disk cache.</DL>
<HR>
<A NAME="discardBackingStore()"><!-- --></A><H3>
discardBackingStore</H3>
<PRE>
protected void <B>discardBackingStore</B>()</PRE>
<DL>
<DD>Assuming backing-store is in use, delete the underlying temp file.</DL>
<HR>
<A NAME="createBackingStoreInputStream()"><!-- --></A><H3>
createBackingStoreInputStream</H3>
<PRE>
protected java.io.InputStream <B>createBackingStoreInputStream</B>()
throws java.io.FileNotFoundException</PRE>
<DL>
<DD>Assuming backing-store is in use, creates an InputStream that reads
from the underlying TempFile, and will call this.discardBuffer()
when that InputStream reaches EOF.</DL>
<!-- ========= 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" ID="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> &nbsp;<FONT ID="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../help-doc.html"><FONT ID="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" ID="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../calypso/util/ByteToCharConverterEnumeration.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../calypso/util/CharArray.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="CacheOutputStream.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
</BODY>
</HTML>