/** * @param command the command to send * @param remote the remote file name * @return the output stream to write to * @throws IOException on error * @since 3.1 */ protected OutputStream _storeFileStream(String command, String remote) throws IOException { Socket socket = _openDataConnection_(command, remote); if (socket == null) { return null; } final OutputStream output; if (__fileType == ASCII_FILE_TYPE) { // We buffer ascii transfers because the buffering has to // be interposed between ToNetASCIIOutputSream and the underlying // socket output stream. We don't buffer binary transfers // because we don't want to impose a buffering policy on the // programmer if possible. Programmers can decide on their // own if they want to wrap the SocketOutputStream we return // for file types other than ASCII. output = new ToNetASCIIOutputStream(getBufferedOutputStream(socket.getOutputStream())); } else { output = socket.getOutputStream(); } return new org.apache.commons.net.io.SocketOutputStream(socket, output); }
private OutputStream __storeFileStream(int command, String remote) throws IOException { OutputStream output; Socket socket; if ((socket = _openDataConnection_(command, remote)) == null) return null; output = socket.getOutputStream(); if (__fileType == ASCII_FILE_TYPE) { // We buffer ascii transfers because the buffering has to // be interposed between ToNetASCIIOutputSream and the underlying // socket output stream. We don't buffer binary transfers // because we don't want to impose a buffering policy on the // programmer if possible. Programmers can decide on their // own if they want to wrap the SocketOutputStream we return // for file types other than ASCII. output = new BufferedOutputStream(output, getBufferSize()); output = new ToNetASCIIOutputStream(output); } return new org.apache.commons.net.io.SocketOutputStream(socket, output); }
private OutputStream __storeFileStream(int command, String remote) throws IOException { OutputStream output; Socket socket; if ((socket = _openDataConnection_(command, remote)) == null) return null; output = socket.getOutputStream(); if (__fileType == ASCII_FILE_TYPE) { // We buffer ascii transfers because the buffering has to // be interposed between ToNetASCIIOutputSream and the underlying // socket output stream. We don't buffer binary transfers // because we don't want to impose a buffering policy on the // programmer if possible. Programmers can decide on their // own if they want to wrap the SocketOutputStream we return // for file types other than ASCII. output = new BufferedOutputStream(output, getBufferSize()); output = new ToNetASCIIOutputStream(output); } return new org.apache.commons.net.io.SocketOutputStream(socket, output); }