gnu.inet.ftp
Class AsciiOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
              |
              +--gnu.inet.ftp.AsciiOutputStream

public class AsciiOutputStream
extends java.io.FilterOutputStream

The AsciiOutputStream class acts as a filter to convert outgoing ASCII FTP streams from the system's local ASCII format by filtering and converting line termination strings. Note that the class as currently written will only handle \r\n or single character line termination strings; a more technically correct implementation would be preferable.


Field Summary
protected  boolean active
           
protected  int eol
           
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
AsciiOutputStream(java.io.OutputStream out)
          Creates an AsciiOutputStream by passing out to its superclass' constructor and determining the system-specific line termination string.
 
Method Summary
 void write(byte[] b)
          Writes b.length bytes to this output stream.
 void write(byte[] b, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this output stream.
 void write(int b)
          Writes the specified byte to this output stream.
 
Methods inherited from class java.io.FilterOutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

active

protected boolean active

eol

protected int eol
Constructor Detail

AsciiOutputStream

public AsciiOutputStream(java.io.OutputStream out)
                  throws java.lang.Exception
Creates an AsciiOutputStream by passing out to its superclass' constructor and determining the system-specific line termination string.
Parameters:
out - the underlying output stream.
Throws:
java.lang.Exception - if system line separator is longer than 1 char and is not \r\n
Method Detail

write

public void write(int b)
           throws java.io.IOException
Writes the specified byte to this output stream.
Overrides:
write in class java.io.FilterOutputStream
Parameters:
b - the byte.
Throws:
java.io.IOException - if an I/O error occurs.

write

public void write(byte[] b)
           throws java.io.IOException
Writes b.length bytes to this output stream.
Overrides:
write in class java.io.FilterOutputStream
Parameters:
b - the data to be written.
Throws:
java.io.IOException - if an I/O error occurs.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.
Overrides:
write in class java.io.FilterOutputStream
Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.
Throws:
java.io.IOException - if an I/O error occurs.