You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stephane Demurget (JIRA)" <ji...@apache.org> on 2008/05/14 15:29:55 UTC

[jira] Created: (IO-169) FileUtils.copyFileToURL

FileUtils.copyFileToURL
-----------------------

                 Key: IO-169
                 URL: https://issues.apache.org/jira/browse/IO-169
             Project: Commons IO
          Issue Type: New Feature
          Components: Utilities
    Affects Versions: 1.4, 2.0
            Reporter: Stephane Demurget
            Priority: Trivial


FileUtils contains the very useful FileUtils.copyURLToFile. It would makes sense to do it the other around too, or rename them download vs. upload and deprecate the old one. I can provide a quick patch if needed, but this is trivial.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (IO-169) FileUtils.copyFileToURL

Posted by "François LEIBER (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741750#action_12741750 ] 

François LEIBER edited comment on IO-169 at 8/11/09 1:10 AM:
-------------------------------------------------------------

Something like this:
{code}
	/**
	 * {@link FileUtils#copyURLToFile(URL, File)} but the types the other way around to upload a file to FTP.
	 */
	public static void copyFileToURL(File source, URL destination) throws IOException {
		FileInputStream input = new FileInputStream(source);
		
		try {
			OutputStream output = destination.openConnection().getOutputStream();

			try {
				IOUtils.copy(input, output);
			} finally {
				IOUtils.closeQuietly(output);
			}
		} finally {
			IOUtils.closeQuietly(input);
		}
	}
{code}

      was (Author: fleiber):
    Something like this:

	/**
	 * {@link FileUtils#copyURLToFile(URL, File)} but the types the other way around to upload a file to FTP.
	 */
	public static void copyFileToURL(File source, URL destination) throws IOException {
		FileInputStream input = new FileInputStream(source);
		
		try {
			OutputStream output = destination.openConnection().getOutputStream();

			try {
				IOUtils.copy(input, output);
			} finally {
				IOUtils.closeQuietly(output);
			}
		} finally {
			IOUtils.closeQuietly(input);
		}
	}

  
> FileUtils.copyFileToURL
> -----------------------
>
>                 Key: IO-169
>                 URL: https://issues.apache.org/jira/browse/IO-169
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Stephane Demurget
>            Priority: Trivial
>             Fix For: 2.x
>
>
> FileUtils contains the very useful FileUtils.copyURLToFile. It would makes sense to do it the other around too, or rename them download vs. upload and deprecate the old one. I can provide a quick patch if needed, but this is trivial.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (IO-169) FileUtils.copyFileToURL

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated IO-169:
-------------------------------

    Affects Version/s:     (was: 2.0)
        Fix Version/s: 2.x

> FileUtils.copyFileToURL
> -----------------------
>
>                 Key: IO-169
>                 URL: https://issues.apache.org/jira/browse/IO-169
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Stephane Demurget
>            Priority: Trivial
>             Fix For: 2.x
>
>
> FileUtils contains the very useful FileUtils.copyURLToFile. It would makes sense to do it the other around too, or rename them download vs. upload and deprecate the old one. I can provide a quick patch if needed, but this is trivial.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IO-169) FileUtils.copyFileToURL

Posted by "François LEIBER (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741750#action_12741750 ] 

François LEIBER commented on IO-169:
------------------------------------

Something like this:

	/**
	 * {@link FileUtils#copyURLToFile(URL, File)} but the types the other way around to upload a file to FTP.
	 */
	public static void copyFileToURL(File source, URL destination) throws IOException {
		FileInputStream input = new FileInputStream(source);
		
		try {
			OutputStream output = destination.openConnection().getOutputStream();

			try {
				IOUtils.copy(input, output);
			} finally {
				IOUtils.closeQuietly(output);
			}
		} finally {
			IOUtils.closeQuietly(input);
		}
	}


> FileUtils.copyFileToURL
> -----------------------
>
>                 Key: IO-169
>                 URL: https://issues.apache.org/jira/browse/IO-169
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Stephane Demurget
>            Priority: Trivial
>             Fix For: 2.x
>
>
> FileUtils contains the very useful FileUtils.copyURLToFile. It would makes sense to do it the other around too, or rename them download vs. upload and deprecate the old one. I can provide a quick patch if needed, but this is trivial.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IO-169) FileUtils.copyFileToURL

Posted by "François LEIBER (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752058#action_12752058 ] 

François LEIBER commented on IO-169:
------------------------------------

Well, it's about the same as the FileUtils.copyURLToFile method, which isn't out of scope?

> FileUtils.copyFileToURL
> -----------------------
>
>                 Key: IO-169
>                 URL: https://issues.apache.org/jira/browse/IO-169
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Stephane Demurget
>            Priority: Trivial
>             Fix For: 2.x
>
>
> FileUtils contains the very useful FileUtils.copyURLToFile. It would makes sense to do it the other around too, or rename them download vs. upload and deprecate the old one. I can provide a quick patch if needed, but this is trivial.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IO-169) FileUtils.copyFileToURL

Posted by "Jochen Wiedmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741752#action_12741752 ] 

Jochen Wiedmann commented on IO-169:
------------------------------------

I think this topic is beyond the scope of commons-io. Recommended to use commons-vfs instead.


> FileUtils.copyFileToURL
> -----------------------
>
>                 Key: IO-169
>                 URL: https://issues.apache.org/jira/browse/IO-169
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Stephane Demurget
>            Priority: Trivial
>             Fix For: 2.x
>
>
> FileUtils contains the very useful FileUtils.copyURLToFile. It would makes sense to do it the other around too, or rename them download vs. upload and deprecate the old one. I can provide a quick patch if needed, but this is trivial.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IO-169) FileUtils.copyFileToURL

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666026#action_12666026 ] 

Jukka Zitting commented on IO-169:
----------------------------------

How would this work in practice? Would an upload to a HTTP URL become a PUT request?

> FileUtils.copyFileToURL
> -----------------------
>
>                 Key: IO-169
>                 URL: https://issues.apache.org/jira/browse/IO-169
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Stephane Demurget
>            Priority: Trivial
>             Fix For: 2.x
>
>
> FileUtils contains the very useful FileUtils.copyURLToFile. It would makes sense to do it the other around too, or rename them download vs. upload and deprecate the old one. I can provide a quick patch if needed, but this is trivial.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (IO-169) FileUtils.copyFileToURL

Posted by "François LEIBER (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741750#action_12741750 ] 

François LEIBER edited comment on IO-169 at 8/11/09 1:11 AM:
-------------------------------------------------------------

Something like this:
{code}
/**
 * {@link FileUtils#copyURLToFile(URL, File)} but the types the other way around to upload a file to FTP.
 */
public static void copyFileToURL(File source, URL destination) throws IOException {
	FileInputStream input = new FileInputStream(source);
	
	try {
		OutputStream output = destination.openConnection().getOutputStream();

		try {
			IOUtils.copy(input, output);
		} finally {
			IOUtils.closeQuietly(output);
		}
	} finally {
		IOUtils.closeQuietly(input);
	}
}
{code}

      was (Author: fleiber):
    Something like this:
{code}
	/**
	 * {@link FileUtils#copyURLToFile(URL, File)} but the types the other way around to upload a file to FTP.
	 */
	public static void copyFileToURL(File source, URL destination) throws IOException {
		FileInputStream input = new FileInputStream(source);
		
		try {
			OutputStream output = destination.openConnection().getOutputStream();

			try {
				IOUtils.copy(input, output);
			} finally {
				IOUtils.closeQuietly(output);
			}
		} finally {
			IOUtils.closeQuietly(input);
		}
	}
{code}
  
> FileUtils.copyFileToURL
> -----------------------
>
>                 Key: IO-169
>                 URL: https://issues.apache.org/jira/browse/IO-169
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Stephane Demurget
>            Priority: Trivial
>             Fix For: 2.x
>
>
> FileUtils contains the very useful FileUtils.copyURLToFile. It would makes sense to do it the other around too, or rename them download vs. upload and deprecate the old one. I can provide a quick patch if needed, but this is trivial.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.