cvs commit: spice/sandbox/repository/componenthaus/src/java/org/componenthaus/util/file FileManager.java FileManagerImpl.java

Mike Hogan <[email protected]> Sun, 09 Nov 2003 06:00:49 -0800
Newsgroups gmane.comp.java.spice.cvs
Message-ID <[email protected]>
hogie       03/11/09 06:00:49

  Modified:    sandbox/repository/componenthaus/src/java/org/componenthaus/util/file
                        FileManager.java FileManagerImpl.java
  Log:
  If components are classes, show as little of the class as necessary to show service offering
  
  Revision  Changes    Path
  1.5       +1 -9      spice/sandbox/repository/componenthaus/src/java/org/componenthaus/util/file/FileManager.java
  
  Index: FileManager.java
  ===================================================================
  RCS file: /cvsroot/spice/spice/sandbox/repository/componenthaus/src/java/org/componenthaus/util/file/FileManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileManager.java	26 Oct 2003 14:43:09 -0000	1.4
  +++ FileManager.java	9 Nov 2003 14:00:49 -0000	1.5
  @@ -2,18 +2,10 @@
   
   import java.io.File;
   import java.io.IOException;
  -import java.io.OutputStream;
   import java.io.InputStream;
  -import java.io.FileNotFoundException;
  +import java.io.OutputStream;
   
  -/**
  - * TODO make into a component and distribute separately.  With a monitor class for file creation etc.
  - */
   public interface FileManager {
  -    String basename(String path);
       void copy(File from, OutputStream to) throws IOException;
  -    String asString(File f) throws IOException;
  -    File newFile(String fileName);
       void copy(InputStream inputStream, File target) throws IOException;
  -    public void copy(InputStream from, OutputStream to) throws IOException;
   }
  
  
  
  1.7       +1 -20     spice/sandbox/repository/componenthaus/src/java/org/componenthaus/util/file/FileManagerImpl.java
  
  Index: FileManagerImpl.java
  ===================================================================
  RCS file: /cvsroot/spice/spice/sandbox/repository/componenthaus/src/java/org/componenthaus/util/file/FileManagerImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FileManagerImpl.java	26 Oct 2003 14:43:09 -0000	1.6
  +++ FileManagerImpl.java	9 Nov 2003 14:00:49 -0000	1.7
  @@ -7,20 +7,11 @@
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.OutputStream;
  -import java.io.StringWriter;
   import java.io.Writer;
   
   public class FileManagerImpl implements FileManager {
       private static final int chunk = 1024;
   
  -    public String basename(String path) {
  -        final int lastIndexOfSlash = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
  -        if (lastIndexOfSlash != -1) {
  -            return path.substring(lastIndexOfSlash + 1);
  -        }
  -        return path;
  -    }
  -
       public void copy(File from, OutputStream to) throws IOException {
           assert from != null;
           assert to != null;
  @@ -29,7 +20,7 @@
           in.close();
       }
   
  -    public void copy(InputStream from, OutputStream to) throws IOException {
  +    private void copy(InputStream from, OutputStream to) throws IOException {
           final byte[] buff = new byte[chunk];
           int bytesRead = -1;
           while (-1 != (bytesRead = from.read(buff, 0, buff.length))) {
  @@ -47,16 +38,6 @@
               to.write(new String(buff,0,bytesRead));
           }
           in.close();
  -    }
  -
  -    public String asString(File f) throws IOException {
  -        final StringWriter writer = new StringWriter();
  -        copy(f,writer);
  -        return writer.toString();
  -    }
  -
  -    public File newFile(String fileName) {
  -        return new File(fileName);
       }
   
       public void copy(InputStream from, File to) throws IOException {
  
  
  


-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/