Produced by Araxis Merge on 9/25/2018 2:13:12 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\sun\net\ftp | FtpClient.java | Mon Jan 22 14:46:54 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\sun\net\ftp | FtpClient.java | Wed Sep 12 17:44:44 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 1884 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /* | |
2 | * Copyrig ht (c) 200 9, 2013, O racle and/ or its aff iliates. A ll rights reserved. | |
3 | * DO NOT ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER. | |
4 | * | |
5 | * This co de is free software; you can r edistribut e it and/o r modify i t | |
6 | * under t he terms o f the GNU General Pu blic Licen se version 2 only, a s | |
7 | * publish ed by the Free Softw are Founda tion. Ora cle design ates this | |
8 | * particu lar file a s subject to the "Cl asspath" e xception a s provided | |
9 | * by Orac le in the LICENSE fi le that ac companied this code. | |
10 | * | |
11 | * This co de is dist ributed in the hope that it wi ll be usef ul, but WI THOUT | |
12 | * ANY WAR RANTY; wit hout even the implie d warranty of MERCHA NTABILITY or | |
13 | * FITNESS FOR A PAR TICULAR PU RPOSE. Se e the GNU General Pu blic Licen se | |
14 | * version 2 for mor e details (a copy is included in the LIC ENSE file that | |
15 | * accompa nied this code). | |
16 | * | |
17 | * You sho uld have r eceived a copy of th e GNU Gene ral Public License v ersion | |
18 | * 2 along with this work; if not, write to the Fr ee Softwar e Foundati on, | |
19 | * Inc., 5 1 Franklin St, Fifth Floor, Bo ston, MA 0 2110-1301 USA. | |
20 | * | |
21 | * Please contact Or acle, 500 Oracle Par kway, Redw ood Shores , CA 94065 USA | |
22 | * or visi t www.orac le.com if you need a dditional informatio n or have any | |
23 | * questio ns. | |
24 | */ | |
25 | package su n.net.ftp; | |
26 | ||
27 | import jav a.net.*; | |
28 | import jav a.io.*; | |
29 | import jav a.util.Dat e; | |
30 | import jav a.util.Lis t; | |
31 | import jav a.util.Ite rator; | |
32 | ||
33 | /** | |
34 | * A class that impl ements the FTP proto col accord ing to | |
35 | * RFCs <A href="htt p://www.ie tf.org/rfc /rfc0959.t xt">959</A >, | |
36 | * <A href ="http://w ww.ietf.or g/rfc/rfc2 228.txt">2 228</A>, | |
37 | * <A href ="http://w ww.ietf.or g/rfc/rfc2 389.txt">2 389</A>, | |
38 | * <A href ="http://w ww.ietf.or g/rfc/rfc2 428.txt">2 428</A>, | |
39 | * <A href ="http://w ww.ietf.or g/rfc/rfc3 659.txt">3 659</A>, | |
40 | * <A href ="http://w ww.ietf.or g/rfc/rfc4 217.txt">4 217</A>. | |
41 | * Which i ncludes su pport for FTP over S SL/TLS (ak a ftps). | |
42 | * | |
43 | * {@code FtpClient} provides all the fu nctionalit ies of a t ypical FTP | |
44 | * client, like stor ing or ret rieving fi les, listi ng or crea ting direc tories. | |
45 | * A typic al usage w ould consi st of conn ecting the client to the serve r, | |
46 | * log in, issue a f ew command s then log out. | |
47 | * Here is a code ex ample: | |
48 | * <pre> | |
49 | * FtpClie nt cl = Ft pClient.cr eate(); | |
50 | * cl.conn ect("ftp.g nu.org").l ogin("anon ymous", "j ohn.doe@my domain.com ".toCharAr ray())).ch angeDirect ory("pub/g nu"); | |
51 | * Iterato r<FtpDi rEntry> dir = cl. listFiles( ); | |
52 | * whi le (dir.ha sNext()) { | |
53 | * FtpDirEnt ry f = dir .next(); | |
54 | * System.er r.println( f.getName( )); | |
55 | * } | |
56 | * cl. close(); | |
57 | * } | |
58 | * </pre> | |
59 | * <p><b>E rror repor ting:</b> There are, mostly, t wo familie s of error s that | |
60 | * can occ ur during an FTP ses sion. The first kind are the n etwork rel ated issue s | |
61 | * like a connection reset, an d they are usually f atal to th e session, meaning, | |
62 | * in all likelyhood the conne ction to t he server has been l ost and th e session | |
63 | * should be restart ed from sc ratch. The se errors are report ed by thro wing an | |
64 | * {@link IOExceptio n}. The se cond kind are the er rors repor ted by the FTP serve r, | |
65 | * like wh en trying to downloa d a non-ex isting fil e for exam ple. These errors | |
66 | * are usu ally non f atal to th e session, meaning m ore comman ds can be sent to th e | |
67 | * server. In these cases, a { @link FtpP rotocolExc eption} is thrown.</ p> | |
68 | * <p> | |
69 | * It shou ld be note d that thi s is not a thread-sa fe API, as it wouldn 't make | |
70 | * too muc h sense, d ue to the very seque ntial natu re of FTP, to provid e a | |
71 | * client able to be manipulat ed from mu ltiple thr eads. | |
72 | * | |
73 | * @since 1.7 | |
74 | */ | |
75 | public abs tract clas s FtpClien t implemen ts java.io .Closeable { | |
76 | ||
77 | private st atic final int FTP_P ORT
|
|
78 | ||
79 | public static en um Transfe rType { | |
80 | ||
81 | AS CII, BINAR Y, EBCDIC | |
82 | }; | |
83 | ||
84 | /** | |
85 | * Ret urns the d efault FTP port numb er. | |
86 | * | |
87 | * @re turn the p ort number . | |
88 | */ | |
89 | public static fi nal int de faultPort( ) { | |
90 | re turn FTP_P ORT; | |
91 | } | |
92 | ||
93 | /** | |
94 | * Cre ates an in stance of FtpClient. The clien t is not c onnected t o any | |
95 | * ser ver yet. | |
96 | * | |
97 | */ | |
98 | protec ted FtpCli ent() { | |
99 | } | |
100 | ||
101 | /** | |
102 | * Cre ates an in stance of {@code Ftp Client}. T he client is not con nected to any | |
103 | * ser ver yet. | |
104 | * | |
105 | * @re turn the c reated {@c ode FtpCli ent} | |
106 | */ | |
107 | public static Ft pClient cr eate() { | |
108 | Ft pClientPro vider prov ider = Ftp ClientProv ider.provi der(); | |
109 | re turn provi der.create FtpClient( ); | |
110 | } | |
111 | ||
112 | /** | |
113 | * Cre ates an in stance of FtpClient and connec ts it to t he specifi ed | |
114 | * add ress. | |
115 | * | |
116 | * @pa ram dest t he {@code InetSocket Address} t o connect to. | |
117 | * @re turn The c reated {@c ode FtpCli ent} | |
118 | * @th rows IOExc eption if the connec tion fails | |
119 | * @se e #connect (java.net. SocketAddr ess) | |
120 | */ | |
121 | public static Ft pClient cr eate(InetS ocketAddre ss dest) t hrows FtpP rotocolExc eption, IO Exception { | |
122 | Ft pClient cl ient = cre ate(); | |
123 | if (dest != null) { | |
124 | client.c onnect(des t); | |
125 | } | |
126 | re turn clien t; | |
127 | } | |
128 | ||
129 | /** | |
130 | * Cre ates an in stance of {@code Ftp Client} an d connects it to the | |
131 | * spe cified hos t on the d efault FTP port. | |
132 | * | |
133 | * @pa ram dest t he {@code String} co ntaining t he name of the host | |
134 | * to con nect to. | |
135 | * @re turn The c reated {@c ode FtpCli ent} | |
136 | * @th rows IOExc eption if the connec tion fails . | |
137 | * @th rows FtpPr otocolExce ption if t he server rejected t he connect ion | |
138 | */ | |
139 | public static Ft pClient cr eate(Strin g dest) th rows FtpPr otocolExce ption, IOE xception { | |
140 | re turn creat e(new Inet SocketAddr ess(dest, FTP_PORT)) ; | |
141 | } | |
142 | ||
143 | /** | |
144 | * Ena bles, or d isables, t he use of the <I>pas sive</I> m ode. In th at mode, | |
145 | * dat a connecti ons are es tablished by having the client connect t o the serv er. | |
146 | * Thi s is the r ecommended default m ode as it will work best throu gh | |
147 | * fir ewalls and NATs. If set to {@c ode false} the mode is said to be | |
148 | * <I> active</I> which mea ns the ser ver will c onnect bac k to the c lient | |
149 | * aft er a PORT command to establish a data co nnection. | |
150 | * | |
151 | * <p> <b>Note:</ b> Since t he passive mode migh t not be s upported b y all | |
152 | * FTP servers, enabling i t means th e client w ill try to use it. I f the | |
153 | * ser ver reject s it, then the clien t will att empt to fa ll back to using | |
154 | * the <I>active </I> mode by issuing a {@code PORT} comm and instea d.</p> | |
155 | * | |
156 | * @pa ram passiv e {@code t rue} to fo rce passiv e mode. | |
157 | * @re turn This FtpClient | |
158 | * @se e #isPassi veModeEnab led() | |
159 | */ | |
160 | public abstract FtpClient enablePass iveMode(bo olean pass ive); | |
161 | ||
162 | /** | |
163 | * Tes ts whether passive m ode is ena bled. | |
164 | * | |
165 | * @re turn {@cod e true} if the passi ve mode ha s been ena bled. | |
166 | * @se e #enableP assiveMode (boolean) | |
167 | */ | |
168 | public abstract boolean is PassiveMod eEnabled() ; | |
169 | ||
170 | /** | |
171 | * Set s the defa ult timeou t value to use when connecting to the se rver, | |
172 | * | |
173 | * @pa ram timeou t the time out value, in millis econds, to use for t he connect | |
174 | * operat ion. A val ue of zero or less, means use the defaul t timeout. | |
175 | * | |
176 | * @re turn This FtpClient | |
177 | */ | |
178 | public abstract FtpClient setConnect Timeout(in t timeout) ; | |
179 | ||
180 | /** | |
181 | * Ret urns the c urrent def ault conne ction time out value. | |
182 | * | |
183 | * @re turn the v alue, in m illisecond s, of the current co nnect time out. | |
184 | * @se e #setConn ectTimeout (int) | |
185 | */ | |
186 | public abstract int getCon nectTimeou t(); | |
187 | ||
188 | /** | |
189 | * Set s the time out value to use whe n reading from the s erver, | |
190 | * | |
191 | * @pa ram timeou t the time out value, in millis econds, to use for t he read | |
192 | * operat ion. A val ue of zero or less, means use the defaul t timeout. | |
193 | * @re turn This FtpClient | |
194 | */ | |
195 | public abstract FtpClient setReadTim eout(int t imeout); | |
196 | ||
197 | /** | |
198 | * Ret urns the c urrent rea d timeout value. | |
199 | * | |
200 | * @re turn the v alue, in m illisecond s, of the current re ad timeout . | |
201 | * @se e #setRead Timeout(in t) | |
202 | */ | |
203 | public abstract int getRea dTimeout() ; | |
204 | ||
205 | /** | |
206 | * Set the {@cod e Proxy} t o be used for the ne xt connect ion. | |
207 | * If the client is alread y connecte d, it does n't affect the curre nt | |
208 | * con nection. H owever it is not rec ommended t o change t his during a session . | |
209 | * | |
210 | * @pa ram p the {@code Pro xy} to use , or {@cod e null} fo r no proxy . | |
211 | * @re turn This FtpClient | |
212 | */ | |
213 | public abstract FtpClient setProxy(P roxy p); | |
214 | ||
215 | /** | |
216 | * Get the proxy of this F tpClient | |
217 | * | |
218 | * @re turn the { @code Prox y}, this c lient is u sing, or { @code null } | |
219 | * if none is us ed. | |
220 | * @se e #setProx y(Proxy) | |
221 | */ | |
222 | public abstract Proxy getP roxy(); | |
223 | ||
224 | /** | |
225 | * Tes ts whether this clie nt is conn ected or n ot to a se rver. | |
226 | * | |
227 | * @re turn {@cod e true} if the clien t is conne cted. | |
228 | */ | |
229 | public abstract boolean is Connected( ); | |
230 | ||
231 | /** | |
232 | * Con nects the {@code Ftp Client} to the speci fied desti nation ser ver. | |
233 | * | |
234 | * @pa ram dest t he address of the de stination server | |
235 | * @re turn this FtpClient | |
236 | * @th rows IOExc eption if connection failed. | |
237 | * @th rows Secur ityExcepti on if ther e is a Sec urityManag er install ed and it | |
238 | * den ied the au thorizatio n to conne ct to the destinatio n. | |
239 | * @th rows FtpPr otocolExce ption | |
240 | */ | |
241 | public abstract FtpClient connect(So cketAddres s dest) th rows FtpPr otocolExce ption, IOE xception; | |
242 | ||
243 | /** | |
244 | * Con nects the FtpClient to the spe cified des tination s erver. | |
245 | * | |
246 | * @pa ram dest t he address of the de stination server | |
247 | * @pa ram timeou t the valu e, in mill iseconds, to use as a connecti on timeout | |
248 | * @re turn this FtpClient | |
249 | * @th rows IOExc eption if connection failed. | |
250 | * @th rows Secur ityExcepti on if ther e is a Sec urityManag er install ed and it | |
251 | * den ied the au thorizatio n to conne ct to the destinatio n. | |
252 | * @th rows FtpPr otocolExce ption | |
253 | */ | |
254 | public abstract FtpClient connect(So cketAddres s dest, in t timeout) throws Ft pProtocolE xception, IOExceptio n; | |
255 | ||
256 | /** | |
257 | * Ret rieves the address o f the FTP server thi s client i s connecte d to. | |
258 | * | |
259 | * @re turn the { @link Sock etAddress} of the se rver, or { @code null } if this | |
260 | * cli ent is not connected yet. | |
261 | */ | |
262 | public abstract SocketAddr ess getSer verAddress (); | |
263 | ||
264 | /** | |
265 | * Att empts to l og on the server wit h the spec ified user name and password. | |
266 | * | |
267 | * @pa ram user T he user na me | |
268 | * @pa ram passwo rd The pas sword for that user | |
269 | * @re turn this FtpClient | |
270 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n | |
271 | * @th rows FtpPr otocolExce ption if t he login w as refused by the se rver | |
272 | */ | |
273 | public abstract FtpClient login(Stri ng user, c har[] pass word) thro ws FtpProt ocolExcept ion, IOExc eption; | |
274 | ||
275 | /** | |
276 | * Att empts to l og on the server wit h the spec ified user name, pas sword and | |
277 | * acc ount name. | |
278 | * | |
279 | * @pa ram user T he user na me | |
280 | * @pa ram passwo rd The pas sword for that user. | |
281 | * @pa ram accoun t The acco unt name f or that us er. | |
282 | * @re turn this FtpClient | |
283 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
284 | * @th rows FtpPr otocolExce ption if t he login w as refused by the se rver | |
285 | */ | |
286 | public abstract FtpClient login(Stri ng user, c har[] pass word, Stri ng account ) throws F tpProtocol Exception, IOExcepti on; | |
287 | ||
288 | /** | |
289 | * Clo ses the cu rrent conn ection. Lo gs out the current u ser, if an y, by | |
290 | * iss uing the Q UIT comman d to the s erver. | |
291 | * Thi s is in ef fect termi nates the current | |
292 | * ses sion and t he connect ion to the server wi ll be clos ed. | |
293 | * <p> After a cl ose, the c lient can then be co nnected to another s erver | |
294 | * to start an e ntirely di fferent se ssion.</P> | |
295 | * | |
296 | * @th rows IOExc eption if an error o ccurs duri ng transmi ssion | |
297 | */ | |
298 | public abstract void close () throws IOExceptio n; | |
299 | ||
300 | /** | |
301 | * Che cks whethe r the clie nt is logg ed in to t he server or not. | |
302 | * | |
303 | * @re turn {@cod e true} if the clien t has alre ady comple ted a logi n. | |
304 | */ | |
305 | public abstract boolean is LoggedIn() ; | |
306 | ||
307 | /** | |
308 | * Cha nges to a specific d irectory o n a remote FTP serve r | |
309 | * | |
310 | * @pa ram remot eDirectory path of t he directo ry to CD t o. | |
311 | * @re turn this FtpClient | |
312 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
313 | * @th rows FtpPr otocolExce ption if t he command was refus ed by the server | |
314 | */ | |
315 | public abstract FtpClient changeDire ctory(Stri ng remoteD irectory) throws Ftp ProtocolEx ception, I OException ; | |
316 | ||
317 | /** | |
318 | * Cha nges to th e parent d irectory, sending th e CDUP com mand to th e server. | |
319 | * | |
320 | * @re turn this FtpClient | |
321 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
322 | * @th rows FtpPr otocolExce ption if t he command was refus ed by the server | |
323 | */ | |
324 | public abstract FtpClient changeToPa rentDirect ory() thro ws FtpProt ocolExcept ion, IOExc eption; | |
325 | ||
326 | /** | |
327 | * Ret rieve the server cur rent worki ng directo ry using t he PWD com mand. | |
328 | * | |
329 | * @re turn a {@c ode String } containi ng the cur rent worki ng directo ry | |
330 | * @th rows IOExc eption if an error o ccurs duri ng transmi ssion | |
331 | * @th rows FtpPr otocolExce ption if t he command was refus ed by the server, | |
332 | */ | |
333 | public abstract String get WorkingDir ectory() t hrows FtpP rotocolExc eption, IO Exception; | |
334 | ||
335 | /** | |
336 | * Set s the rest art offset to the sp ecified va lue. That value wil l be | |
337 | * sen t through a {@code R EST} comma nd to serv er before the next f ile | |
338 | * tra nsfer and has the ef fect of re suming a f ile transf er from th e | |
339 | * spe cified poi nt. After the transf er the res tart offse t is set b ack to | |
340 | * zer o. | |
341 | * | |
342 | * @pa ram offset the offse t in the r emote file at which to start t he next | |
343 | * transf er. This m ust be a v alue great er than or equal to zero. | |
344 | * @re turn this FtpClient | |
345 | * @th rows Illeg alArgument Exception if the off set is neg ative. | |
346 | */ | |
347 | public abstract FtpClient setRestart Offset(lon g offset); | |
348 | ||
349 | /** | |
350 | * Ret rieves a f ile from t he ftp ser ver and wr ites its c ontent to the specif ied | |
351 | * {@c ode Output Stream}. | |
352 | * <p> If the res tart offse t was set, then a {@ code REST} command w ill be | |
353 | * sen t before t he {@code RETR} in o rder to re start the tranfer fr om the spe cified | |
354 | * off set.</p> | |
355 | * <p> The {@code OutputStr eam} is no t closed b y this met hod at the end | |
356 | * of the transf er. </p> | |
357 | * <p> This metho d will blo ck until t he transfe r is compl ete or an exception | |
358 | * is thrown.</p > | |
359 | * | |
360 | * @pa ram name a {@code St ring} cont aining the name of t he file to | |
361 | * retrei ve from th e server. | |
362 | * @pa ram local the {@code OutputStr eam} the f ile should be writte n to. | |
363 | * @re turn this FtpClient | |
364 | * @th rows IOExc eption if the transf er fails. | |
365 | * @th rows FtpPr otocolExce ption if t he command was refus ed by the server | |
366 | * @se e #setRest artOffset( long) | |
367 | */ | |
368 | public abstract FtpClient getFile(St ring name, OutputStr eam local) throws Ft pProtocolE xception, IOExceptio n; | |
369 | ||
370 | /** | |
371 | * Ret rieves a f ile from t he ftp ser ver, using the {@cod e RETR} co mmand, and | |
372 | * ret urns the I nputStream from the establishe d data con nection. | |
373 | * {@l ink #compl etePending ()} <b>has </b> to be called on ce the app lication | |
374 | * is done readi ng from th e returned stream. | |
375 | * <p> If the res tart offse t was set, then a {@ code REST} command w ill be | |
376 | * sen t before t he {@code RETR} in o rder to re start the tranfer fr om the spe cified | |
377 | * off set.</p> | |
378 | * | |
379 | * @pa ram name t he name of the remot e file | |
380 | * @re turn the { @link java .io.InputS tream} fro m the data connectio n | |
381 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
382 | * @th rows FtpPr otocolExce ption if t he command was refus ed by the server | |
383 | * @se e #setRest artOffset( long) | |
384 | */ | |
385 | public abstract InputStrea m getFileS tream(Stri ng name) t hrows FtpP rotocolExc eption, IO Exception; | |
386 | ||
387 | /** | |
388 | * Tra nsfers a f ile from t he client to the ser ver (aka a <I>put</I >) | |
389 | * by sending th e STOR com mand, and returns th e {@code O utputStrea m} | |
390 | * fro m the esta blished da ta connect ion. | |
391 | * | |
392 | * A n ew file is created a t the serv er site if the file specified does | |
393 | * not already e xist. | |
394 | * | |
395 | * {@l ink #compl etePending ()} <b>has </b> to be called on ce the app lication | |
396 | * is finished w riting to the return ed stream. | |
397 | * | |
398 | * @pa ram name t he name of the remot e file to write. | |
399 | * @re turn the { @link java .io.Output Stream} fr om the dat a connecti on or | |
400 | * {@cod e null} if the comma nd was uns uccessful. | |
401 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
402 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
403 | */ | |
404 | public OutputStr eam putFil eStream(St ring name) throws Ft pProtocolE xception, IOExceptio n { | |
405 | re turn putFi leStream(n ame, false ); | |
406 | } | |
407 | ||
408 | /** | |
409 | * Tra nsfers a f ile from t he client to the ser ver (aka a <I>put</I >) | |
410 | * by sending th e STOR or STOU comma nd, depend ing on the | |
411 | * {@c ode unique } argument , and retu rns the {@ code Outpu tStream} | |
412 | * fro m the esta blished da ta connect ion. | |
413 | * {@l ink #compl etePending ()} <b>has </b> to be called on ce the app lication | |
414 | * is finished w riting to the stream . | |
415 | * | |
416 | * A n ew file is created a t the serv er site if the file specified does | |
417 | * not already e xist. | |
418 | * | |
419 | * If {@code uni que} is se t to {@cod e true}, t he resulta nt file | |
420 | * is to be crea ted under a name uni que to tha t director y, meaning | |
421 | * it will not o verwrite a n existing file, ins tead the s erver will | |
422 | * gen erate a ne w, unique, file name . | |
423 | * The name of t he remote file can b e retrieve d, after c ompletion of the | |
424 | * tra nsfer, by calling {@ link #getL astFileNam e()}. | |
425 | * | |
426 | * @pa ram name t he name of the remot e file to write. | |
427 | * @pa ram unique {@code tr ue} if the remote fi les should be unique , | |
428 | * in whi ch case th e STOU com mand will be used. | |
429 | * @re turn the { @link java .io.Output Stream} fr om the dat a connecti on. | |
430 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
431 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
432 | */ | |
433 | public abstract OutputStre am putFile Stream(Str ing name, boolean un ique) thro ws FtpProt ocolExcept ion, IOExc eption; | |
434 | ||
435 | /** | |
436 | * Tra nsfers a f ile from t he client to the ser ver (aka a <I>put</I >) | |
437 | * by sending th e STOR or STOU comma nd, depend ing on the | |
438 | * {@c ode unique } argument . The cont ent of the {@code In putStream} | |
439 | * pas sed in arg ument is w ritten int o the remo te file, o verwriting any | |
440 | * exi sting data . | |
441 | * | |
442 | * A n ew file is created a t the serv er site if the file specified does | |
443 | * not already e xist. | |
444 | * | |
445 | * If {@code uni que} is se t to {@cod e true}, t he resulta nt file | |
446 | * is to be crea ted under a name uni que to tha t director y, meaning | |
447 | * it will not o verwrite a n existing file, ins tead the s erver will | |
448 | * gen erate a ne w, unique, file name . | |
449 | * The name of t he remote file can b e retrieve d, after c ompletion of the | |
450 | * tra nsfer, by calling {@ link #getL astFileNam e()}. | |
451 | * | |
452 | * <p> This metho d will blo ck until t he transfe r is compl ete or an exception | |
453 | * is thrown.</p > | |
454 | * | |
455 | * @pa ram name t he name of the remot e file to write. | |
456 | * @pa ram local the {@code InputStre am} that p oints to t he data to | |
457 | * transf er. | |
458 | * @re turn this FtpClient | |
459 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
460 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
461 | */ | |
462 | public FtpClient putFile(S tring name , InputStr eam local) throws Ft pProtocolE xception, IOExceptio n { | |
463 | re turn putFi le(name, l ocal, fals e); | |
464 | } | |
465 | ||
466 | /** | |
467 | * Tra nsfers a f ile from t he client to the ser ver (aka a <I>put</I >) | |
468 | * by sending th e STOR com mand. The content of the {@cod e InputStr eam} | |
469 | * pas sed in arg ument is w ritten int o the remo te file, o verwriting any | |
470 | * exi sting data . | |
471 | * | |
472 | * A n ew file is created a t the serv er site if the file specified does | |
473 | * not already e xist. | |
474 | * | |
475 | * <p> This metho d will blo ck until t he transfe r is compl ete or an exception | |
476 | * is thrown.</p > | |
477 | * | |
478 | * @pa ram name t he name of the remot e file to write. | |
479 | * @pa ram local the {@code InputStre am} that p oints to t he data to | |
480 | * transf er. | |
481 | * @pa ram unique {@code tr ue} if the remote fi le should be unique | |
482 | * (i.e. not alread y existing ), {@code false} oth erwise. | |
483 | * @re turn this FtpClient | |
484 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
485 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
486 | * @se e #getLast FileName() | |
487 | */ | |
488 | public abstract FtpClient putFile(St ring name, InputStre am local, boolean un ique) thro ws FtpProt ocolExcept ion, IOExc eption; | |
489 | ||
490 | /** | |
491 | * Sen ds the APP E command to the ser ver in ord er to tran sfer a dat a stream | |
492 | * pas sed in arg ument and append it to the con tent of th e specifie d remote | |
493 | * fil e. | |
494 | * | |
495 | * <p> This metho d will blo ck until t he transfe r is compl ete or an exception | |
496 | * is thrown.</p > | |
497 | * | |
498 | * @pa ram name A {@code St ring} cont aining the name of t he remote file | |
499 | * to app end to. | |
500 | * @pa ram local The {@code InputStre am} provid ing access to the da ta | |
501 | * to be appended. | |
502 | * @re turn this FtpClient | |
503 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
504 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
505 | */ | |
506 | public abstract FtpClient appendFile (String na me, InputS tream loca l) throws FtpProtoco lException , IOExcept ion; | |
507 | ||
508 | /** | |
509 | * Ren ames a fil e on the s erver. | |
510 | * | |
511 | * @pa ram from t he name of the file being rena med | |
512 | * @pa ram to the new name for the fi le | |
513 | * @re turn this FtpClient | |
514 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
515 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
516 | */ | |
517 | public abstract FtpClient rename(Str ing from, String to) throws Ft pProtocolE xception, IOExceptio n; | |
518 | ||
519 | /** | |
520 | * Del etes a fil e on the s erver. | |
521 | * | |
522 | * @pa ram name a {@code St ring} cont aining the name of t he file | |
523 | * to del ete. | |
524 | * @re turn this FtpClient | |
525 | * @th rows IOExc eption if an error o ccurred du ring the e xchange | |
526 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
527 | */ | |
528 | public abstract FtpClient deleteFile (String na me) throws FtpProtoc olExceptio n, IOExcep tion; | |
529 | ||
530 | /** | |
531 | * Cre ates a new directory on the se rver. | |
532 | * | |
533 | * @pa ram name a {@code St ring} cont aining the name of t he directo ry | |
534 | * to cre ate. | |
535 | * @re turn this FtpClient | |
536 | * @th rows IOExc eption if an error o ccurred du ring the e xchange | |
537 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
538 | */ | |
539 | public abstract FtpClient makeDirect ory(String name) thr ows FtpPro tocolExcep tion, IOEx ception; | |
540 | ||
541 | /** | |
542 | * Rem oves a dir ectory on the server . | |
543 | * | |
544 | * @pa ram name a {@code St ring} cont aining the name of t he directo ry | |
545 | * to rem ove. | |
546 | * | |
547 | * @re turn this FtpClient | |
548 | * @th rows IOExc eption if an error o ccurred du ring the e xchange. | |
549 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
550 | */ | |
551 | public abstract FtpClient removeDire ctory(Stri ng name) t hrows FtpP rotocolExc eption, IO Exception; | |
552 | ||
553 | /** | |
554 | * Sen ds a No-op eration co mmand. It' s useful f or testing the conne ction | |
555 | * sta tus or as a <I>keep alive</I> mechanism. | |
556 | * | |
557 | * @re turn this FtpClient | |
558 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
559 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
560 | */ | |
561 | public abstract FtpClient noop() thr ows FtpPro tocolExcep tion, IOEx ception; | |
562 | ||
563 | /** | |
564 | * Sen ds the {@c ode STAT} command to the serve r. | |
565 | * Thi s can be u sed while a data con nection is open to g et a statu s | |
566 | * on the curren t transfer , in that case the p arameter s hould be | |
567 | * {@c ode null}. | |
568 | * If used betwe en file tr ansfers, i t may have a pathnam e as argum ent | |
569 | * in which case it will w ork as the LIST comm and except no data | |
570 | * con nection wi ll be crea ted. | |
571 | * | |
572 | * @pa ram name a n optional {@code St ring} cont aining the pathname | |
573 | * the ST AT command should ap ply to. | |
574 | * @re turn the r esponse fr om the ser ver | |
575 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
576 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
577 | */ | |
578 | public abstract String get Status(Str ing name) throws Ftp ProtocolEx ception, I OException ; | |
579 | ||
580 | /** | |
581 | * Sen ds the {@c ode FEAT} command to the serve r and retu rns the li st of supp orted | |
582 | * fea tures in t he form of strings. | |
583 | * | |
584 | * The features are the su pported co mmands, li ke AUTH TL S, PROT or PASV. | |
585 | * See the RFCs for a comp lete list. | |
586 | * | |
587 | * Not e that not all FTP s ervers sup port that command, i n which ca se | |
588 | * a { @link FtpP rotocolExc eption} wi ll be thro wn. | |
589 | * | |
590 | * @re turn a {@c ode List} of {@code Strings} d escribing the | |
591 | * suppo rted addit ional feat ures | |
592 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
593 | * @th rows FtpPr otocolExce ption if t he command is reject ed by the server | |
594 | */ | |
595 | public abstract List<Strin g> getFeat ures() thr ows FtpPro tocolExcep tion, IOEx ception; | |
596 | ||
597 | /** | |
598 | * Sen ds the {@c ode ABOR} command to the serve r. | |
599 | * <p> It tells t he server to stop th e previous command o r transfer . No actio n | |
600 | * wil l be taken if the pr evious com mand has a lready bee n complete d.</p> | |
601 | * <p> This doesn 't abort t he current session, more comma nds can be issued | |
602 | * aft er an abor t.</p> | |
603 | * | |
604 | * @re turn this FtpClient | |
605 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
606 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
607 | */ | |
608 | public abstract FtpClient abort() th rows FtpPr otocolExce ption, IOE xception; | |
609 | ||
610 | /** | |
611 | * Som e methods do not wai t until co mpletion b efore retu rning, so this | |
612 | * met hod can be called to wait unti l completi on. This i s typicall y the case | |
613 | * wit h commands that trig ger a tran sfer like {@link #ge tFileStrea m(String)} . | |
614 | * So this metho d should b e called b efore acce ssing info rmation re lated to | |
615 | * suc h a comman d. | |
616 | * <p> This metho d will act ually bloc k reading on the com mand chann el for a | |
617 | * not ification from the s erver that the comma nd is fini shed. Such a | |
618 | * not ification often carr ies extra informatio n concerni ng the com pletion | |
619 | * of the pendin g action ( e.g. numbe r of bytes transfere d).</p> | |
620 | * <p> Note that this will return imm ediately i f no comma nd or acti on | |
621 | * is pending</p > | |
622 | * <p> It should be also no ted that m ost method s issuing commands t o the ftp | |
623 | * ser ver will c all this m ethod if a previous command is pending. | |
624 | * <p> Example of use: | |
625 | * <pr e> | |
626 | * Inp utStream i n = cl.get FileStream ("file"); | |
627 | * ... | |
628 | * cl. completePe nding(); | |
629 | * lon g size = c l.getLastT ransferSiz e(); | |
630 | * </p re> | |
631 | * On the other hand, it's not neces sary in a case like: | |
632 | * <pr e> | |
633 | * Inp utStream i n = cl.get FileStream ("file"); | |
634 | * // read conte nt | |
635 | * ... | |
636 | * cl. close(); | |
637 | * </p re> | |
638 | * <p> Since {@li nk #close( )} will ca ll complet ePending() if necess ary.</p> | |
639 | * @re turn this FtpClient | |
640 | * @th rows IOExc eption if an error o ccurred du ring the t ransfer | |
641 | * @th rows FtpPr otocolExce ption if t he command didn't co mplete suc cessfully | |
642 | */ | |
643 | public abstract FtpClient completePe nding() th rows FtpPr otocolExce ption, IOE xception; | |
644 | ||
645 | /** | |
646 | * Rei nitializes the USER parameters on the FT P server | |
647 | * | |
648 | * @re turn this FtpClient | |
649 | * @th rows IOExc eption if an error o ccurs duri ng transmi ssion | |
650 | * @th rows FtpPr otocolExce ption if t he command fails | |
651 | */ | |
652 | public abstract FtpClient reInit() t hrows FtpP rotocolExc eption, IO Exception; | |
653 | ||
654 | /** | |
655 | * Cha nges the t ransfer ty pe (binary , ascii, e bcdic) and issue the | |
656 | * pro per comman d (e.g. TY PE A) to t he server. | |
657 | * | |
658 | * @pa ram type t he {@code TransferTy pe} to use . | |
659 | * @re turn This FtpClient | |
660 | * @th rows IOExc eption if an error o ccurs duri ng transmi ssion. | |
661 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
662 | */ | |
663 | public abstract FtpClient setType(Tr ansferType type) thr ows FtpPro tocolExcep tion, IOEx ception; | |
664 | ||
665 | /** | |
666 | * Cha nges the c urrent tra nsfer type to binary . | |
667 | * Thi s is a con venience m ethod that is equiva lent to | |
668 | * {@c ode setTyp e(Transfer Type.BINAR Y)} | |
669 | * | |
670 | * @re turn This FtpClient | |
671 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
672 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
673 | * @se e #setType (TransferT ype) | |
674 | */ | |
675 | public FtpClient setBinary Type() thr ows FtpPro tocolExcep tion, IOEx ception { | |
676 | se tType(Tran sferType.B INARY); | |
677 | re turn this; | |
678 | } | |
679 | ||
680 | /** | |
681 | * Cha nges the c urrent tra nsfer type to ascii. | |
682 | * Thi s is a con venience m ethod that is equiva lent to | |
683 | * {@c ode setTyp e(Transfer Type.ASCII )} | |
684 | * | |
685 | * @re turn This FtpClient | |
686 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
687 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
688 | * @se e #setType (TransferT ype) | |
689 | */ | |
690 | public FtpClient setAsciiT ype() thro ws FtpProt ocolExcept ion, IOExc eption { | |
691 | se tType(Tran sferType.A SCII); | |
692 | re turn this; | |
693 | } | |
694 | ||
695 | /** | |
696 | * Iss ues a {@co de LIST} c ommand to the server to get th e current directory | |
697 | * lis ting, and returns th e InputStr eam from t he data co nnection. | |
698 | * | |
699 | * <p> {@link #co mpletePend ing()} <b> has</b> to be called once the applicatio n | |
700 | * is finished r eading fro m the stre am.</p> | |
701 | * | |
702 | * @pa ram path t he pathnam e of the d irectory t o list, or {@code nu ll} | |
703 | * for th e current working di rectory. | |
704 | * @re turn the { @code Inpu tStream} f rom the re sulting da ta connect ion | |
705 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
706 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
707 | * @se e #changeD irectory(S tring) | |
708 | * @se e #listFil es(String) | |
709 | */ | |
710 | public abstract InputStrea m list(Str ing path) throws Ftp ProtocolEx ception, I OException ; | |
711 | ||
712 | /** | |
713 | * Iss ues a {@co de NLST pa th} comman d to serve r to get t he specifi ed directo ry | |
714 | * con tent. It d iffers fro m {@link # list(Strin g)} method by the fa ct that | |
715 | * it will only list the f ile names which woul d make the parsing o f the | |
716 | * som ewhat easi er. | |
717 | * | |
718 | * <p> {@link #co mpletePend ing()} <b> has</b> to be called once the applicatio n | |
719 | * is finished r eading fro m the stre am.</p> | |
720 | * | |
721 | * @pa ram path a {@code St ring} cont aining the pathname of the | |
722 | * direct ory to lis t or {@cod e null} fo r the curr ent workin g director y. | |
723 | * @re turn the { @code Inpu tStream} f rom the re sulting da ta connect ion | |
724 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
725 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
726 | */ | |
727 | public abstract InputStrea m nameList (String pa th) throws FtpProtoc olExceptio n, IOExcep tion; | |
728 | ||
729 | /** | |
730 | * Iss ues the {@ code SIZE [path]} co mmand to t he server to get the size of a | |
731 | * spe cific file on the se rver. | |
732 | * Not e that thi s command may not be supported by the se rver. In w hich | |
733 | * cas e -1 will be returne d. | |
734 | * | |
735 | * @pa ram path a {@code St ring} cont aining the pathname of the | |
736 | * file. | |
737 | * @re turn a {@c ode long} containing the size of the fil e or -1 if | |
738 | * the s erver retu rned an er ror, which can be ch ecked with | |
739 | * {@lin k #getLast ReplyCode( )}. | |
740 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
741 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
742 | */ | |
743 | public abstract long getSi ze(String path) thro ws FtpProt ocolExcept ion, IOExc eption; | |
744 | ||
745 | /** | |
746 | * Iss ues the {@ code MDTM [path]} co mmand to t he server to get the modificat ion | |
747 | * tim e of a spe cific file on the se rver. | |
748 | * Not e that thi s command may not be supported by the se rver, in w hich | |
749 | * cas e {@code n ull} will be returne d. | |
750 | * | |
751 | * @pa ram path a {@code St ring} cont aining the pathname of the fil e. | |
752 | * @re turn a {@c ode Date} representi ng the las t modifica tion time | |
753 | * or {@ code null} if the se rver retur ned an err or, which | |
754 | * can b e checked with {@lin k #getLast ReplyCode( )}. | |
755 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
756 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
757 | */ | |
758 | public abstract Date getLa stModified (String pa th) throws FtpProtoc olExceptio n, IOExcep tion; | |
759 | ||
760 | /** | |
761 | * Set s the pars er used to handle th e director y output t o the spec ified | |
762 | * one . By defau lt the par ser is set to one th at can han dle most F TP | |
763 | * ser vers outpu t (Unix ba se mostly) . However it may be necessary for | |
764 | * and applicati on to prov ide its ow n parser d ue to some uncommon | |
765 | * out put format . | |
766 | * | |
767 | * @pa ram p The {@code Ftp DirParser} to use. | |
768 | * @re turn this FtpClient | |
769 | * @se e #listFil es(String) | |
770 | */ | |
771 | public abstract FtpClient setDirPars er(FtpDirP arser p); | |
772 | ||
773 | /** | |
774 | * Iss ues a {@co de MLSD} c ommand to the server to get th e specifie d director y | |
775 | * lis ting and a pplies the internal parser to create an Iterator o f | |
776 | * {@l ink java.n et.FtpDirE ntry}. Not e that the Iterator returned i s also a | |
777 | * {@l ink java.i o.Closeabl e}. | |
778 | * <p> If the ser ver doesn' t support the MLSD c ommand, th e LIST com mand is us ed | |
779 | * ins tead and t he parser set by {@l ink #setDi rParser(ja va.net.Ftp DirParser) } | |
780 | * is used inste ad.</p> | |
781 | * | |
782 | * {@l ink #compl etePending ()} <b>has </b> to be called on ce the app lication | |
783 | * is finished i terating t hrough the files. | |
784 | * | |
785 | * @pa ram path t he pathnam e of the d irectory t o list or {@code nul l} | |
786 | * for th e current working di rectoty. | |
787 | * @re turn a {@c ode Iterat or} of fil es or {@co de null} i f the | |
788 | * comma nd failed. | |
789 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n | |
790 | * @se e #setDirP arser(FtpD irParser) | |
791 | * @se e #changeD irectory(S tring) | |
792 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
793 | */ | |
794 | public abstract Iterator<F tpDirEntry > listFile s(String p ath) throw s FtpProto colExcepti on, IOExce ption; | |
795 | ||
796 | /** | |
797 | * Att empts to u se Kerbero s GSSAPI a s an authe ntication mechanism with the | |
798 | * ftp server. T his will i ssue an {@ code AUTH GSSAPI} co mmand, and if | |
799 | * it is accepte d by the s erver, wil l followup with {@co de ADAT} | |
800 | * com mand to ex change the various t okens unti l authenti cation is | |
801 | * suc cessful. T his confor ms to Appe ndix I of RFC 2228. | |
802 | * | |
803 | * @re turn this FtpClient | |
804 | * @th rows IOExc eption if an error o ccurs duri ng the tra nsmission. | |
805 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
806 | */ | |
807 | public abstract FtpClient useKerbero s() throws FtpProtoc olExceptio n, IOExcep tion; | |
808 | ||
809 | /** | |
810 | * Ret urns the W elcome str ing the se rver sent during ini tial conne ction. | |
811 | * | |
812 | * @re turn a {@c ode String } containi ng the mes sage the s erver | |
813 | * retur ned during connectio n or {@cod e null}. | |
814 | */ | |
815 | public abstract String get WelcomeMsg (); | |
816 | ||
817 | /** | |
818 | * Ret urns the l ast reply code sent by the ser ver. | |
819 | * | |
820 | * @re turn the l astReplyCo de or {@co de null} i f none wer e received yet. | |
821 | */ | |
822 | public abstract FtpReplyCo de getLast ReplyCode( ); | |
823 | ||
824 | /** | |
825 | * Ret urns the l ast respon se string sent by th e server. | |
826 | * | |
827 | * @re turn the m essage str ing, which can be qu ite long, last retur ned | |
828 | * by th e server, or {@code null} if n o response were rece ived yet. | |
829 | */ | |
830 | public abstract String get LastRespon seString() ; | |
831 | ||
832 | /** | |
833 | * Ret urns, when available , the size of the la test start ed transfe r. | |
834 | * Thi s is retre ived by pa rsing the response s tring rece ived as an initial | |
835 | * res ponse to a {@code RE TR} or sim ilar reque st. | |
836 | * | |
837 | * @re turn the s ize of the latest tr ansfer or -1 if eith er there w as no | |
838 | * trans fer or the informati on was una vailable. | |
839 | */ | |
840 | public abstract long getLa stTransfer Size(); | |
841 | ||
842 | /** | |
843 | * Ret urns, when available , the remo te name of the last transfered file. | |
844 | * Thi s is mainl y useful f or "put" o peration w hen the un ique flag was | |
845 | * set since it allows to recover th e unique f ile name c reated on the | |
846 | * ser ver which may be dif ferent fro m the one submitted with the c ommand. | |
847 | * | |
848 | * @re turn the n ame the la test trans fered file remote na me, or | |
849 | * {@cod e null} if that info rmation is unavailab le. | |
850 | */ | |
851 | public abstract String get LastFileNa me(); | |
852 | ||
853 | /** | |
854 | * Att empts to s witch to a secure, e ncrypted c onnection. This is d one by | |
855 | * sen ding the { @code AUTH TLS} comm and. | |
856 | * <p> See <a hre f="http:// www.ietf.o rg/rfc/rfc 4217.txt"> RFC 4217</ a></p> | |
857 | * If successful this will establish a secure command ch annel with the | |
858 | * ser ver, it wi ll also ma ke it so t hat all ot her transf ers (e.g. a RETR | |
859 | * com mand) will be done o ver an enc rypted cha nnel as we ll unless a | |
860 | * {@l ink #reIni t()} comma nd or a {@ link #endS ecureSessi on()} comm and is iss ued. | |
861 | * <p> This metho d should b e called a fter a suc cessful {@ link #conn ect(java.n et.InetSoc ketAddress ) } | |
862 | * but before ca lling {@li nk #login( java.lang. String, ch ar[]) }.</ p> | |
863 | * | |
864 | * @re turn this FtpCLient | |
865 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
866 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
867 | * @se e #endSecu reSession( ) | |
868 | */ | |
869 | public abstract FtpClient startSecur eSession() throws Ft pProtocolE xception, IOExceptio n; | |
870 | ||
871 | /** | |
872 | * Sen ds a {@cod e CCC} com mand follo wed by a { @code PROT C} | |
873 | * com mand to th e server t erminating an encryp ted sessio n and reve rting | |
874 | * bac k to a non encrypted transmiss ion. | |
875 | * | |
876 | * @re turn this FtpClient | |
877 | * @th rows IOExc eption if an error o ccurred du ring trans mission. | |
878 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
879 | * @se e #startSe cureSessio n() | |
880 | */ | |
881 | public abstract FtpClient endSecureS ession() t hrows FtpP rotocolExc eption, IO Exception; | |
882 | ||
883 | /** | |
884 | * Sen ds the "Al locate" ({ @code ALLO }) command to the se rver telli ng it to | |
885 | * pre -allocate the specif ied number of bytes for the ne xt transfe r. | |
886 | * | |
887 | * @pa ram size T he number of bytes t o allocate . | |
888 | * @re turn this FtpClient | |
889 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
890 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
891 | */ | |
892 | public abstract FtpClient allocate(l ong size) throws Ftp ProtocolEx ception, I OException ; | |
893 | ||
894 | /** | |
895 | * Sen ds the "St ructure Mo unt" ({@co de SMNT}) command to the serve r. This le t the | |
896 | * use r mount a different file syste m data str ucture wit hout alter ing his | |
897 | * log in or acco unting inf ormation. | |
898 | * | |
899 | * @pa ram struct a {@code String} co ntaining t he name of the | |
900 | * struct ure to mou nt. | |
901 | * @re turn this FtpClient | |
902 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
903 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
904 | */ | |
905 | public abstract FtpClient structureM ount(Strin g struct) throws Ftp ProtocolEx ception, I OException ; | |
906 | ||
907 | /** | |
908 | * Sen ds a Syste m ({@code SYST}) com mand to th e server a nd returns the Strin g | |
909 | * sen t back by the server describin g the oper ating syst em at the | |
910 | * ser ver. | |
911 | * | |
912 | * @re turn a {@c ode String } describi ng the OS, or {@code null} | |
913 | * if th e operatio n was not successful . | |
914 | * @th rows IOExc eption if an error o ccurred du ring the t ransmissio n. | |
915 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
916 | */ | |
917 | public abstract String get System() t hrows FtpP rotocolExc eption, IO Exception; | |
918 | ||
919 | /** | |
920 | * Sen ds the {@c ode HELP} command to the serve r, with an optional command, l ike | |
921 | * SIT E, and ret urns the t ext sent b ack by the server. | |
922 | * | |
923 | * @pa ram cmd th e command for which the help i s requeste d or | |
924 | * {@code null} for the gener al help | |
925 | * @re turn a {@c ode String } containi ng the tex t sent bac k by the | |
926 | * serve r, or {@co de null} i f the comm and failed . | |
927 | * @th rows IOExc eption if an error o ccurred du ring trans mission | |
928 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
929 | */ | |
930 | public abstract String get Help(Strin g cmd) thr ows FtpPro tocolExcep tion, IOEx ception; | |
931 | ||
932 | /** | |
933 | * Sen ds the {@c ode SITE} command to the serve r. This is used by t he server | |
934 | * to provide se rvices spe cific to h is system that are e ssential | |
935 | * to file trans fer. | |
936 | * | |
937 | * @pa ram cmd th e command to be sent . | |
938 | * @re turn this FtpClient | |
939 | * @th rows IOExc eption if an error o ccurred du ring trans mission | |
940 | * @th rows FtpPr otocolExce ption if t he command was rejec ted by the server | |
941 | */ | |
942 | public abstract FtpClient siteCmd(St ring cmd) throws Ftp ProtocolEx ception, I OException ; | |
943 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.