You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by bw...@apache.org on 2003/05/24 02:09:28 UTC

cvs commit: maven-new/fetch/src/main/java/org/apache/maven/fetch/transports Transport.java

bwalding    2003/05/23 17:09:28

  Added:       fetch/src/main/java/org/apache/maven/fetch
                        DownloadRequest.java IOUtility.java
                        DownloadResponse.java DownloadTool.java
               fetch/src/main/java/org/apache/maven/fetch/exceptions
                        TransportDepException.java DepException.java
               fetch/src/main/java/org/apache/maven/fetch/transports
                        Transport.java
  Log:
  New component
  
  Revision  Changes    Path
  1.1                  maven-new/fetch/src/main/java/org/apache/maven/fetch/DownloadRequest.java
  
  Index: DownloadRequest.java
  ===================================================================
  package org.apache.maven.fetch;
  
  import java.io.File;
  import java.io.OutputStream;
  
  /**
   * @author  Ben Walding
   * @version $Id: DownloadRequest.java,v 1.1 2003/05/24 00:09:27 bwalding Exp $
   */
  public class DownloadRequest
  {
      private OutputStream outputStream;
      private String url;
      private File outputDir;
      private File outputFile;
      private boolean resumeDownload = false;
  
      public DownloadRequest(String url)
      {
  
      }
  
      private void clearOutput()
      {
          this.outputFile = null;
          this.outputDir = null;
          this.outputStream = null;
      }
  
      public void setOutputFile(File outputFile)
      {
          clearOutput();
          this.outputFile = outputFile;
      }
  
      public void setOutputDir(File outputDir)
      {
          clearOutput();
          this.outputDir = outputDir;
      }
  
      public void setOutputStream(OutputStream outputStream)
      {
          clearOutput();
          this.outputStream = outputStream;
      }
  
  }
  
  
  
  1.1                  maven-new/fetch/src/main/java/org/apache/maven/fetch/IOUtility.java
  
  Index: IOUtility.java
  ===================================================================
  package org.apache.maven.fetch;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  
  /**
   * @author  Ben Walding
   * @version $Id: IOUtility.java,v 1.1 2003/05/24 00:09:27 bwalding Exp $
   */
  public class IOUtility {
      protected static final int BUFFER_SIZE = 16384;
      
      /**
       * Transfers all remaining data in the input stream to the output stream
       * 
       * Neither stream will be closed at completion.
       **/
      public static void transferStream(InputStream is, OutputStream os)
          throws IOException {
          final byte[] buffer = new byte[BUFFER_SIZE];
          while (true) {
              int bytesRead = is.read(buffer, 0, buffer.length);
              if (bytesRead == -1)
                  break;
              os.write(buffer, 0, bytesRead);
          }
      }
      
      public static final void close(InputStream in) {
          try {
              if (in != null) {
                  in.close();
              } 
          } catch (IOException ioex) {
              //Do nothing
          }
      }
  
  
  }
  
  
  
  1.1                  maven-new/fetch/src/main/java/org/apache/maven/fetch/DownloadResponse.java
  
  Index: DownloadResponse.java
  ===================================================================
  package org.apache.maven.fetch;
  
  import java.io.File;
  
  /**
   * @author  Ben Walding
   * @version $Id: DownloadResponse.java,v 1.1 2003/05/24 00:09:27 bwalding Exp $
   */
  public class DownloadResponse {
      private File outputFile;
       
      
      /**
       * @return
       */
      public File getOutputFile() {
          return outputFile;
      }
  
      /**
       * only this package should be able to configure a response?
       * @param file
       */
      void setOutputFile(File file) {
          outputFile = file;
      }
  
  }
  
  
  
  1.1                  maven-new/fetch/src/main/java/org/apache/maven/fetch/DownloadTool.java
  
  Index: DownloadTool.java
  ===================================================================
  package org.apache.maven.fetch;
  
  
  /**
   * @author  Ben Walding
   * @version $Id: DownloadTool.java,v 1.1 2003/05/24 00:09:27 bwalding Exp $
   */
  public class DownloadTool {
  
      public DownloadResponse performDownload(DownloadRequest request) {
           return new DownloadResponse();
      }
  }
  
  
  
  1.1                  maven-new/fetch/src/main/java/org/apache/maven/fetch/exceptions/TransportDepException.java
  
  Index: TransportDepException.java
  ===================================================================
  package org.apache.maven.fetch.exceptions;
  
  /**
   * For errors in the underlying transport layer.
   * @author  Ben Walding
   * @version $Id: TransportDepException.java,v 1.1 2003/05/24 00:09:28 bwalding Exp $
   */
  public class TransportDepException {
  
  }
  
  
  
  1.1                  maven-new/fetch/src/main/java/org/apache/maven/fetch/exceptions/DepException.java
  
  Index: DepException.java
  ===================================================================
  package org.apache.maven.fetch.exceptions;
  
  /**
   * @author  Ben Walding
   * @version $Id: DepException.java,v 1.1 2003/05/24 00:09:28 bwalding Exp $
   */
  public class DepException extends Exception {
  
  }
  
  
  
  1.1                  maven-new/fetch/src/main/java/org/apache/maven/fetch/transports/Transport.java
  
  Index: Transport.java
  ===================================================================
  package org.apache.maven.fetch.transports;
  
  /**
   * @author  Ben Walding
   * @version $Id: Transport.java,v 1.1 2003/05/24 00:09:28 bwalding Exp $
   */
  public class Transport {
  
      
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org