cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/xsp/java/org/apache/cocoon/components/language/generator ProgramGeneratorImpl.java
Date Mon, 12 Jul 2004 13:29:57 GMT
antonio     2004/07/12 06:29:57

  Modified:    .        status.xml
               src/java/org/apache/cocoon/util IOUtils.java
               src/blocks/xsp/java/org/apache/cocoon/components/language/generator
                        ProgramGeneratorImpl.java
  Log:
  Deprecate more methodsin class o.a.c.util.IOUtils:
  
  6-public static void serializeString(File file, String string)
  7-public static void serializeString(File file, String string, String encoding)
  8-public static void serializeObject(File file, Object object)
  9-public static Object deserializeObject(File file)
  
  Revision  Changes    Path
  1.399     +5 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.398
  retrieving revision 1.399
  diff -u -r1.398 -r1.399
  --- status.xml	12 Jul 2004 13:04:55 -0000	1.398
  +++ status.xml	12 Jul 2004 13:29:56 -0000	1.399
  @@ -210,9 +210,13 @@
        <ul>
          <li>String baseName(String filename)</li>
          <li>Object bytesToObject(byte[] bytes)</li>
  +       <li>Object deserializeObject(File file)</li>
          <li>String fileComponent(String filename)</li>
          <li>byte[] objectToBytes(Object object)</li>
          <li>String pathComponent(String filename)</li>
  +       <li>void serializeObject(File file, Object object)</li>
  +       <li>void serializeString(File file, String string)</li>
  +       <li>void serializeString(File file, String string, String encoding)</li>
        </ul>
      </action>
     <action dev="AG" type="update">
  
  
  
  1.7       +5 -1      cocoon-2.1/src/java/org/apache/cocoon/util/IOUtils.java
  
  Index: IOUtils.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/util/IOUtils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- IOUtils.java	12 Jul 2004 13:04:55 -0000	1.6
  +++ IOUtils.java	12 Jul 2004 13:29:57 -0000	1.7
  @@ -55,6 +55,7 @@
        * @param file The output file
        * @param string The string to be dumped
        * @exception IOException IO Error
  +     * @deprecated To be removed in cocoon 2.3
        */
       public static void serializeString(File file, String string)
       throws IOException {
  @@ -68,6 +69,7 @@
        * @param string The string to be dumped
        * @param encoding The encoding for the output file or null for default platform encoding
        * @exception IOException IO Error
  +     * @deprecated To be removed in cocoon 2.3
        */
       public static void serializeString(File file, String string, String encoding)
       throws IOException {
  @@ -113,6 +115,7 @@
        * @param file The output file
        * @param object The object to be serialized
        * @exception IOException IOError
  +     * @deprecated To be removed in cocoon 2.3
        */
       public static void serializeObject(File file, Object object)
       throws IOException {
  @@ -132,6 +135,7 @@
        * @param file The input file
        * @return The deserialized object
        * @exception IOException IOError
  +     * @deprecated To be removed in cocoon 2.3
        */
       public static Object deserializeObject(File file)
       throws IOException, ClassNotFoundException {
  
  
  
  1.3       +22 -2     cocoon-2.1/src/blocks/xsp/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/xsp/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProgramGeneratorImpl.java	22 Jun 2004 02:41:15 -0000	1.2
  +++ ProgramGeneratorImpl.java	12 Jul 2004 13:29:57 -0000	1.3
  @@ -42,6 +42,9 @@
   import org.apache.excalibur.source.Source;
   
   import java.io.File;
  +import java.io.FileWriter;
  +import java.io.IOException;
  +import java.io.Writer;
   import java.net.MalformedURLException;
   
   /**
  @@ -457,9 +460,26 @@
           if (sourceDir != null) {
               sourceDir.mkdirs();
           }
  -        IOUtils.serializeString(sourceFile, code);
  +        serializeString(sourceFile, code);
           if (getLogger().isDebugEnabled()) {
               getLogger().debug("Successfully created sourcecode for [" + source.getURI()
+ "]");
  +        }
  +    }
  +
  +    /**
  +     * Dump a <code>String</code> to a text file.
  +     *
  +     * @param file The output file
  +     * @param string The string to be dumped
  +     * @exception IOException IO Error
  +     */
  +    private static void serializeString(File file, String string) throws IOException {
  +        final Writer fw = new FileWriter(file);
  +        try {
  +            fw.write(string);
  +            fw.flush();
  +        } finally {
  +            if (fw != null) fw.close();
           }
       }
   
  
  
  

Mime
View raw message