org.apache.ftpserver.util
Class AsciiOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.ftpserver.util.AsciiOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class AsciiOutputStream
extends OutputStream

Write ASCII data. Before writing it filters the data.

Author:
Rana Bhattacharyya

Constructor Summary
AsciiOutputStream(OutputStream os)
          Constructor.
 
Method Summary
 void close()
          Close stream
 void flush()
          Flush stream data
 long getByteWritten()
          Get actual byte written.
 boolean getIsIgnoreNonAscii()
          Is non ascii character ignored.
 void setIsIgnoreNonAscii(boolean ig)
          Set non-ascii ignore boolean value.
 void write(int i)
          Write a single byte.
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsciiOutputStream

public AsciiOutputStream(OutputStream os)
Constructor.

Parameters:
os - java.io.OutputStream to be filtered.
Method Detail

write

public void write(int i)
           throws IOException
Write a single byte. ASCII characters are defined to be the lower half of an eight-bit code set (i.e., the most significant bit is zero). Change "\n" to "\r\n".

Specified by:
write in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Close stream

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Flush stream data

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

getByteWritten

public long getByteWritten()
Get actual byte written.


getIsIgnoreNonAscii

public boolean getIsIgnoreNonAscii()
Is non ascii character ignored. If true don't write non-ascii character. Else first convert it to ascii by ANDing with 0x7F.


setIsIgnoreNonAscii

public void setIsIgnoreNonAscii(boolean ig)
Set non-ascii ignore boolean value.



Copyright © 2001-2012 Codehaus. All Rights Reserved.