01: package com.coldcore.coloradoftp.filter;
02:
03: import java.nio.channels.ByteChannel;
04: import java.nio.channels.ReadableByteChannel;
05: import java.nio.channels.WritableByteChannel;
06:
07: /**
08: * Filter for data upload/download.
09: *
10: * This data filter sits in the channel (e.g. mounted to file) and parses channels's data on the fly.
11: * Filter must be able to do parsing both ways: from server to user and vice versa.
12: *
13: * Data filters are applied to server's data channels by a data filter applicator based on
14: * the previous user commands (e.g. MODE, TYPE and STRU).
15: *
16: *
17: * ColoradoFTP - The Open Source FTP Server (http://cftp.coldcore.com)
18: */
19: public interface DataFilter extends ByteChannel {
20:
21: /** Set filter name
22: * @param name Filter name
23: */
24: public void setName(String name);
25:
26: /** Get filter name
27: * @return Filter name
28: */
29: public String getName();
30:
31: /** Set the original channel to filter
32: * @param wbc Data channel
33: */
34: public void setChannel(WritableByteChannel wbc);
35:
36: /** Set the original channel to filter.
37: * @param rbc Data channel
38: */
39: public void setChannel(ReadableByteChannel rbc);
40:
41: /** Test if this data filter may change the length of data in a stream.
42: * Some data filters may modify content and size of the file being transferred
43: * on the fly but with the REST command in place the output file may be currupted.
44: * This method prevents commands which operate on file size from executing.
45: * @return TRUE if data length in a stream may change, FALSE if data length will never change
46: */
47: public boolean mayModifyDataLength();
48: }
|