1297 * in which case the STOU command will be used. |
1297 * in which case the STOU command will be used. |
1298 * @return the {@link java.io.OutputStream} from the data connection or |
1298 * @return the {@link java.io.OutputStream} from the data connection or |
1299 * <code>null</code> if the command was unsuccessful. |
1299 * <code>null</code> if the command was unsuccessful. |
1300 * @throws IOException if an error occured during the transmission. |
1300 * @throws IOException if an error occured during the transmission. |
1301 */ |
1301 */ |
1302 public OutputStream putFileStream(String name, boolean unique) throws sun.net.ftp.FtpProtocolException, IOException { |
1302 public OutputStream putFileStream(String name, boolean unique) |
|
1303 throws sun.net.ftp.FtpProtocolException, IOException |
|
1304 { |
1303 String cmd = unique ? "STOU " : "STOR "; |
1305 String cmd = unique ? "STOU " : "STOR "; |
1304 Socket s = openDataConnection(cmd + name); |
1306 Socket s = openDataConnection(cmd + name); |
1305 if (s == null) { |
1307 if (s == null) { |
1306 return null; |
1308 return null; |
1307 } |
1309 } |
1308 if (type == TransferType.BINARY) { |
1310 boolean bm = (type == TransferType.BINARY); |
1309 return s.getOutputStream(); |
1311 return new sun.net.TelnetOutputStream(s.getOutputStream(), bm); |
1310 } |
|
1311 return new sun.net.TelnetOutputStream(s.getOutputStream(), false); |
|
1312 } |
1312 } |
1313 |
1313 |
1314 /** |
1314 /** |
1315 * Transfers a file from the client to the server (aka a <I>put</I>) |
1315 * Transfers a file from the client to the server (aka a <I>put</I>) |
1316 * by sending the STOR command. The content of the <code>InputStream</code> |
1316 * by sending the STOR command. The content of the <code>InputStream</code> |