org.millscript.millscript.functions
Class ShortStringWriter

java.lang.Object
  extended by java.io.Writer
      extended by org.millscript.millscript.functions.ShortStringWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class ShortStringWriter
extends java.io.Writer

This class implements a short string writer, which writes up to a specified number of characters into a StringBuffer for later retrieval.


Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
ShortStringWriter(int l)
          Constructs a new ShortStringWriter which can write up to the specified number of characters.
 
Method Summary
 void close()
           
 void flush()
           
 boolean fullUp()
          Indicates when the maximum number of characters have been written.
 java.lang.StringBuffer getBuffer()
          Returns the underlying StringBuffer for this writer.
 int roomLeft()
          Returns the remaining number of characters that can be written to this writer.
 java.lang.String toString()
          Returns the buffer's current contents.
 void write(char[] cbuf, int off, int len)
           
 void write(int c)
           
 void write(java.lang.String str)
           
 
Methods inherited from class java.io.Writer
append, append, append, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShortStringWriter

public ShortStringWriter(int l)
Constructs a new ShortStringWriter which can write up to the specified number of characters.

Parameters:
l - the maximum number of characters this writer can write
Method Detail

fullUp

public boolean fullUp()
Indicates when the maximum number of characters have been written.

Returns:
true when the maximum number of characters have been written, false otherwise

roomLeft

public int roomLeft()
Returns the remaining number of characters that can be written to this writer.

Returns:
the remaining number of characters that can be written

getBuffer

public java.lang.StringBuffer getBuffer()
Returns the underlying StringBuffer for this writer.

Returns:
the underlying StringBuffer for this writer

toString

public java.lang.String toString()
Returns the buffer's current contents.

Overrides:
toString in class java.lang.Object
Returns:
a String holding the buffers current contents

close

public void close()
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
See Also:
Writer.close()

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException
See Also:
Writer.flush()

write

public void write(int c)
           throws java.io.IOException
Overrides:
write in class java.io.Writer
Throws:
java.io.IOException
See Also:
Writer.write(int)

write

public void write(java.lang.String str)
           throws java.io.IOException
Overrides:
write in class java.io.Writer
Throws:
java.io.IOException
See Also:
Writer.write(java.lang.String)

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException
Specified by:
write in class java.io.Writer
Throws:
java.io.IOException
See Also:
Writer.write(char[], int, int)


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.