ORO, Inc. Logo  All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.oroinc.io.DotTerminatedMessageWriter

java.lang.Object
   |
   +----java.io.Writer
           |
           +----com.oroinc.io.DotTerminatedMessageWriter

public final class DotTerminatedMessageWriter
extends Writer
DotTerminatedMessageWriter is a class used to write messages to a server that are terminated by a single dot followed by a <CR><LF> sequence and with double dots appearing at the begining of lines which do not signal end of message yet start with a dot. Various Internet protocols such as NNTP and POP3 produce messages of this type.

This class handles the doubling of line-starting periods, converts single linefeeds to NETASCII newlines, and on closing will send the final message terminator dot and NETASCII newline sequence.

Copyright © 1997 Original Reusable Objects, Inc. All rights reserved.


Constructor Index

 o DotTerminatedMessageWriter(Writer)
Creates a DotTerminatedMessageWriter that wraps an existing Writer output destination.

Method Index

 o close()
Flushes the underlying output, writing all buffered output, but doesn't actually close the underlying stream.
 o flush()
Flushes the underlying output, writing all buffered output.
 o write(char[])
Writes a character array to the output.
 o write(char[], int, int)
Writes a number of characters from a character array to the output starting from a given offset.
 o write(int)
Writes a character to the output.
 o write(String)
Writes a String to the output.
 o write(String, int, int)
Writes part of a String to the output starting from a given offset.

Constructors

 o DotTerminatedMessageWriter
 public DotTerminatedMessageWriter(Writer output)
Creates a DotTerminatedMessageWriter that wraps an existing Writer output destination.

Parameters:
output - The Writer output destination to write the message.

Methods

 o write
 public void write(int ch) throws IOException
Writes a character to the output. Note that a call to this method may result in multiple writes to the underling Writer in order to convert naked linefeeds to NETASCII line separators and to double line-leading periods. This is transparent to the programmer and is only mentioned for completeness.

Parameters:
ch - The character to write.
Throws: IOException
If an error occurs while writing to the underlying output.
Overrides:
write in class Writer
 o write
 public void write(char buffer[],
                   int offset,
                   int length) throws IOException
Writes a number of characters from a character array to the output starting from a given offset.

Parameters:
buffer - The character array to write.
offset - The offset into the array at which to start copying data.
length - The number of characters to write.
Throws: IOException
If an error occurs while writing to the underlying output.
Overrides:
write in class Writer
 o write
 public void write(char buffer[]) throws IOException
Writes a character array to the output.

Parameters:
buffer - The character array to write.
Throws: IOException
If an error occurs while writing to the underlying output.
Overrides:
write in class Writer
 o write
 public void write(String string) throws IOException
Writes a String to the output.

Parameters:
string - The String to write.
Throws: IOException
If an error occurs while writing to the underlying output.
Overrides:
write in class Writer
 o write
 public void write(String string,
                   int offset,
                   int length) throws IOException
Writes part of a String to the output starting from a given offset.

Parameters:
string - The String to write.
offset - The offset into the String at which to start copying data.
length - The number of characters to write.
Throws: IOException
If an error occurs while writing to the underlying output.
Overrides:
write in class Writer
 o flush
 public void flush() throws IOException
Flushes the underlying output, writing all buffered output.

Throws: IOException
If an error occurs while writing to the underlying output.
Overrides:
flush in class Writer
 o close
 public void close() throws IOException
Flushes the underlying output, writing all buffered output, but doesn't actually close the underlying stream. The underlying stream may still be used for communicating with the server and therefore is not closed.

Throws: IOException
If an error occurs while writing to the underlying output or closing the Writer.
Overrides:
close in class Writer

ORO, Inc. Logo  All Packages  Class Hierarchy  This Package  Previous  Next  Index