You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wagon-commits@maven.apache.org by ca...@apache.org on 2006/05/25 02:13:57 UTC
svn commit: r409268 -
/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
Author: carlos
Date: Wed May 24 17:13:57 2006
New Revision: 409268
URL: http://svn.apache.org/viewvc?rev=409268&view=rev
Log:
Refactor putTransfer method. Add javadocs
Modified:
maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java?rev=409268&r1=409267&r2=409268&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java Wed May 24 17:13:57 2006
@@ -239,6 +239,25 @@
firePutStarted( resource, source );
+ transfer( resource, source, output, closeOutput );
+
+ firePutCompleted( resource, source );
+ }
+
+ /**
+ * Write from {@link File} to {@link OutputStream}
+ *
+ * @since 1.0-beta-1
+ *
+ * @param resource resource to transfer
+ * @param source file to read from
+ * @param output output stream
+ * @param closeOutput whether the output stream should be closed or not
+ * @throws TransferFailedException
+ */
+ protected void transfer( Resource resource, File source, OutputStream output, boolean closeOutput )
+ throws TransferFailedException
+ {
InputStream input = null;
try
@@ -268,15 +287,35 @@
IOUtil.close( output );
}
}
- firePutCompleted( resource, source );
}
+ /**
+ * Write from {@link InputStream} to {@link OutputStream}.
+ * Equivalent to {@link #transfer(Resource, InputStream, OutputStream, int, int)} with a maxSize equal to {@link Integer#MAX_VALUE}
+ *
+ * @param resource resource to transfer
+ * @param input input stream
+ * @param output output stream
+ * @param requestType one of {@link TransferEvent#REQUEST_GET} or {@link TransferEvent#REQUEST_PUT}
+ * @throws IOException
+ */
protected void transfer( Resource resource, InputStream input, OutputStream output, int requestType )
throws IOException
{
transfer( resource, input, output, requestType, Integer.MAX_VALUE );
}
+ /**
+ * Write from {@link InputStream} to {@link OutputStream}.
+ * Equivalent to {@link #transfer(Resource, InputStream, OutputStream, int, int)} with a maxSize equal to {@link Integer#MAX_VALUE}
+ *
+ * @param resource resource to transfer
+ * @param input input stream
+ * @param output output stream
+ * @param requestType one of {@link TransferEvent#REQUEST_GET} or {@link TransferEvent#REQUEST_PUT}
+ * @param maxSize size of the buffer
+ * @throws IOException
+ */
protected void transfer( Resource resource, InputStream input, OutputStream output, int requestType, int maxSize )
throws IOException
{
---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org