org.finj.filter
Class ASCIIDataFilterInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.finj.filter.ASCIIDataFilterInputStream
All Implemented Interfaces:
java.io.Closeable

public class ASCIIDataFilterInputStream
extends java.io.FilterInputStream

Filter to be placed on InputStream when downloading data in org.finj.FTPConstants.ASCII_DATA_TYPE. Exchanges all occurrences of CR, CR/LF, LF/CR, LF for the one that is correct for the plateform on which org.finj.FTPClient is running. FIXME : mention default values.

Copyright (C) 2000-2008 Javier Iglesias.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Version:
$Id: ASCIIDataFilterInputStream.java 47 2008-01-11 23:09:46Z jiglesias $
Author:
Javier Iglesias -- jiglesias@users.sourceforge.net

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
  ASCIIDataFilterInputStream(java.io.InputStream in)
          Constructs a new instance of this class, wrapping and filtering in.
protected ASCIIDataFilterInputStream(java.io.InputStream in, int lineFeed, int carriageReturn)
          Constructs a new instance of this class, resetting the integer values for the LineFeed and CarriageReturn characters to the values provided.
 
Method Summary
 int read()
          Returns one filtered byte from the undelying fields.
 int read(byte[] data)
          Stores as much filtered data as possible to read from the underlying stream.
 int read(byte[] data, int offset, int length)
          Stores as much filtered data as possible to read from the underlying stream.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASCIIDataFilterInputStream

public ASCIIDataFilterInputStream(java.io.InputStream in)
Constructs a new instance of this class, wrapping and filtering in.

Parameters:
in - InputStream to filter.
Since:
v1.0.2

ASCIIDataFilterInputStream

protected ASCIIDataFilterInputStream(java.io.InputStream in,
                                     int lineFeed,
                                     int carriageReturn)
Constructs a new instance of this class, resetting the integer values for the LineFeed and CarriageReturn characters to the values provided.

Parameters:
in - InputStream to filter.
lineFeed - value to consider as being the LineFeed character in the table.
carriageReturn - value to consider as being the CarriageReturn character in the table.
Since:
v1.0.2
Method Detail

read

public int read()
         throws java.io.IOException
Returns one filtered byte from the undelying fields. Any occurrence of LF, or LF+CR, or CR+LF, or CR is replaced by the local system '\n' character. Decision is left to the JVM !

Overrides:
read in class java.io.FilterInputStream
Returns:
value read.
Throws:
java.io.IOException
Since:
v1.0.2

read

public int read(byte[] data)
         throws java.io.IOException
Stores as much filtered data as possible to read from the underlying stream.

Overrides:
read in class java.io.FilterInputStream
Returns:
number of bytes returned.
Throws:
java.io.IOException
Since:
v1.0.2

read

public int read(byte[] data,
                int offset,
                int length)
         throws java.io.IOException
Stores as much filtered data as possible to read from the underlying stream.

Overrides:
read in class java.io.FilterInputStream
Returns:
number of bytes returned.
Throws:
java.io.IOException
Since:
v1.0.2


Copyright © 2009. All Rights Reserved.