jsdever     2003/01/24 16:59:11

  Modified:    httpclient/src/java/org/apache/commons/httpclient/methods/multipart
                        ByteArrayPartSource.java FilePart.java
                        FilePartSource.java Part.java PartSource.java
                        StringPart.java
  Log:
  Experimenting with checkstyle alignments.
  
  Revision  Changes    Path
  1.4       +11 -8     
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/ByteArrayPartSource.java
  
  Index: ByteArrayPartSource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/ByteArrayPartSource.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ByteArrayPartSource.java  23 Jan 2003 22:48:10 -0000      1.3
  +++ ByteArrayPartSource.java  25 Jan 2003 00:59:11 -0000      1.4
  @@ -76,7 +76,10 @@
    */
   public class ByteArrayPartSource implements PartSource {
   
  +    /** Name of the source file. */
       private String fileName;
  +
  +    /** Byte array of the source file. */
       private byte[] bytes;
   
       /**
  @@ -85,7 +88,7 @@
        * @param fileName the name of the file these bytes represent
        * @param bytes the content of this part
        */
  -    public ByteArrayPartSource( String fileName, byte[] bytes ) {
  +    public ByteArrayPartSource(String fileName, byte[] bytes) {
   
           this.fileName = fileName;
           this.bytes = bytes;
  @@ -93,24 +96,24 @@
       }
   
       /**
  -     * @see org.apache.commons.httpclient.methods.multipart.PartSource#getLength()
  +     * @see PartSource#getLength()
        */
       public long getLength() {
           return bytes.length;
       }
   
       /**
  -     * @see org.apache.commons.httpclient.methods.multipart.PartSource#getFileName()
  +     * @see PartSource#getFileName()
        */
       public String getFileName() {
           return fileName;
       }
   
       /**
  -     * @see 
org.apache.commons.httpclient.methods.multipart.PartSource#createInputStream()
  +     * @see PartSource#createInputStream()
        */
       public InputStream createInputStream() throws IOException {
  -        return new ByteArrayInputStream( bytes );
  +        return new ByteArrayInputStream(bytes);
       }
   
   }
  
  
  
  1.9       +14 -14    
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/FilePart.java
  
  Index: FilePart.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/FilePart.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FilePart.java     23 Jan 2003 22:48:10 -0000      1.8
  +++ FilePart.java     25 Jan 2003 00:59:11 -0000      1.9
  @@ -92,13 +92,16 @@
       //TODO: make this configurable
       static int MAX_BUFF_SIZE = 1 * 1024 * 1024;  // 1 MiBs
       
  +    /** Name of the file part. */
       private String name;
  +
  +    /** Source of the file part. */
       private PartSource source;
           
       /**
        * FilePart Constructor.
        *
  -     * @param name
  +     * @param name the name of the file part
        * @param file the file to post
        *
        * @throws FileNotFoundException if the <i>file</i> is not a normal
  @@ -106,14 +109,14 @@
        */
       public FilePart(String name, File file) 
       throws FileNotFoundException {
  -        this( name, new FilePartSource( file ) );
  +        this(name, new FilePartSource(file));
       }
   
        /**
        * FilePart Constructor.
        *
  -     * @param name
  -     * @param fileName
  +     * @param name the name of the file part
  +     * @param fileName the file name 
        * @param file the file to post
        *
        * @throws FileNotFoundException if the <i>file</i> is not a normal
  @@ -121,7 +124,7 @@
        */
       public FilePart(String name, String fileName, File file) 
       throws FileNotFoundException {
  -        this( name, new FilePartSource( fileName, file ) );
  +        this(name, new FilePartSource(fileName, file));
       }
       
       /**
  @@ -130,13 +133,10 @@
        * @param name the name for this part
        * @param partSource the source for this part
        */
  -    public FilePart(
  -        String name, 
  -        PartSource partSource
  -    ) {
  +    public FilePart(String name, PartSource partSource) {
   
  -        if ( partSource.getLength() < 0 ) {
  -            throw new IllegalArgumentException( "fileLength must be >= 0." );   
  +        if (partSource.getLength() < 0) {
  +            throw new IllegalArgumentException("fileLength must be >= 0");
           }
   
           this.name = name;
  
  
  
  1.5       +20 -15    
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/FilePartSource.java
  
  Index: FilePartSource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/FilePartSource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FilePartSource.java       23 Jan 2003 22:48:11 -0000      1.4
  +++ FilePartSource.java       25 Jan 2003 00:59:11 -0000      1.5
  @@ -78,17 +78,21 @@
    */
   public class FilePartSource implements PartSource {
   
  +    /** File part file. */
       private File file;
   
  +    /** File part file name. */
       private String fileName = null;
       
       /**
        * Constructor for FilePartSource.
        * 
  -     * @exception FileNotFoundException if the file does not exist or 
  +     * @param file the FilePart source File. 
  +     *
  +     * @throws FileNotFoundException if the file does not exist or 
        * cannot be read
        */
  -    public FilePartSource( File file ) throws FileNotFoundException {
  +    public FilePartSource(File file) throws FileNotFoundException {
           
           if (! file.isFile()) {
               throw new FileNotFoundException("File is not a normal file.");
  @@ -105,10 +109,14 @@
       /**
        * Constructor for FilePartSource.
        * 
  -     * @exception FileNotFoundException if the file does not exist or 
  +     * @param fileName the file name of the FilePart
  +     * @param file the source File for the FilePart
  +     *
  +     * @throws FileNotFoundException if the file does not exist or 
        * cannot be read
        */
  -    public FilePartSource( String fileName, File file ) throws 
FileNotFoundException {
  +    public FilePartSource(String fileName, File file) 
  +    throws FileNotFoundException {
           
           if (! file.isFile()) {
               throw new FileNotFoundException("File is not a normal file.");
  @@ -123,27 +131,24 @@
       }
       
       /**
  -     * @see org.apache.commons.httpclient.methods.multipart.PartSource#getLength()
  +     * @see PartSource#getLength()
        */
       public long getLength() {
           return file.length();
       }
   
       /**
  -     * @see org.apache.commons.httpclient.methods.multipart.PartSource#getFileName()
  +     * @see PartSource#getFileName()
        */
       public String getFileName() {
  -        if(fileName == null)
  -            return file.getName();
  -        else
  -            return fileName;
  +        return (fileName == null) ? file.getName() : fileName;
       }
   
       /**
  -     * @see 
org.apache.commons.httpclient.methods.multipart.PartSource#createInputStream()
  +     * @see PartSource#createInputStream()
        */
       public InputStream createInputStream() throws IOException {
  -        return new FileInputStream( file );
  +        return new FileInputStream(file);
       }
   
   }
  
  
  
  1.6       +15 -15    
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/Part.java
  
  Index: Part.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/Part.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Part.java 23 Jan 2003 22:48:11 -0000      1.5
  +++ Part.java 25 Jan 2003 00:59:11 -0000      1.6
  @@ -83,6 +83,7 @@
       /** Log object for this class. */
       private static final Log log = LogFactory.getLog(Part.class);
   
  +    //TODO: Make this configurable
       static String boundary = "----------------314159265358979323846";
       static byte[] boundary_bytes = HttpConstants.getBytes(boundary);
       static String CRLF = "\r\n";
  @@ -110,7 +111,7 @@
           
           sendLastBoundary(out);
           
  -        return(out.size());
  +        return out.size();
       }
       
       public abstract String getName();
  @@ -128,7 +129,7 @@
           log.trace("enter lengthOfStart()");
           ByteArrayOutputStream out = new ByteArrayOutputStream();
           sendStart(out);
  -        return(out.size());
  +        return out.size();
       }
       
       protected void sendHeader(OutputStream out) 
  @@ -188,7 +189,7 @@
        * is to make sure they AREN'T overridden. 
        */
   
  -    final public void send(OutputStream out) throws IOException {
  +    public final void send(OutputStream out) throws IOException {
           log.trace("enter send(OutputStream out)");
           sendStart(out);
           sendHeader(out);
  @@ -197,17 +198,16 @@
           sendEnd(out);
       }
       
  -    final public long length() throws IOException {
  +    public final long length() throws IOException {
           log.trace("enter length()");
  -        return lengthOfStart() + 
  -               lengthOfHeader() + 
  -               lengthOfEndOfHeader() +
  -               lengthOfData() + 
  -               lengthOfEnd();
  +        return lengthOfStart()
  +               + lengthOfHeader()
  +               + lengthOfEndOfHeader()
  +               + lengthOfData()
  +               + lengthOfEnd();
       }
       
  -    public String toString()
  -    {
  -     return this.getName();
  +    public String toString() {
  +        return this.getName();
       }
   }
  
  
  
  1.3       +12 -11    
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/PartSource.java
  
  Index: PartSource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/PartSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PartSource.java   23 Jan 2003 22:48:11 -0000      1.2
  +++ PartSource.java   25 Jan 2003 00:59:11 -0000      1.3
  @@ -64,12 +64,12 @@
   
   import java.io.IOException;
   import java.io.InputStream;
  +import org.apache.commons.httpclient.methods.MultipartPostMethod;
   
   /**
    * An interface for providing access to data when posting MultiPart messages.
    * 
  - * @see org.apache.commons.httpclient.methods.multipart.FilePart
  - * @see org.apache.commons.httpclient.methods.MultipartPostMethod#addPart(Part)
  + * @see FilePart
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Michael Becke</a>
    *   
  @@ -82,23 +82,24 @@
        * 
        * @return a value >= 0
        */
  -    public long getLength();
  +    long getLength();
       
       /**
        * Gets the name of the file this source represents.
        * 
        * @return the fileName used for posting a MultiPart file part
        */
  -    public String getFileName();
  +    String getFileName();
       
       /**
  -     * Gets a new InputStream for reading this source.  This method can be called
  -     * more than once and should therefore return a new stream every time.
  +     * Gets a new InputStream for reading this source.  This method can be 
  +     * called more than once and should therefore return a new stream every
  +     * time.
        * 
        * @return a new InputStream
        * 
  -     * @exception IOException if an error occurs when creating the InputStream
  +     * @throws IOException if an error occurs when creating the InputStream
        */
  -    public InputStream createInputStream() throws IOException;
  +    InputStream createInputStream() throws IOException;
   
   }
  
  
  
  1.4       +13 -5     
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/StringPart.java
  
  Index: StringPart.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/StringPart.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StringPart.java   23 Jan 2003 22:48:11 -0000      1.3
  +++ StringPart.java   25 Jan 2003 00:59:11 -0000      1.4
  @@ -74,12 +74,17 @@
    *
    * @since 2.0
    */
  -public class StringPart extends Part
  -{
  +public class StringPart extends Part {
  +
  +    /** Name of this StringPart. */
       private String name;
  +
  +    /** Contents of this StringPart. */
       private String value;
       
       /**
  +     * Constructor.
  +     *
        * @param name
        * @param value the string to post
        */
  @@ -88,6 +93,9 @@
           this.value = value;
       }
   
  +    /**
  +     * @return the name of this StringPart.
  +     */
       public String getName() {
           return name; 
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to