|
Message
From: cvs at opencores.org<cvs@o...>
Date: Sun Jan 20 04:00:18 CET 2008
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/08/01 20:04:00 Modified: jop/java/tools/src/com/jopdesign/libgraph/struct UnknownClassInfo.java ClassInfo.java Log: Using writebuffer to speedup javafile dump big time Revision Changes Path 1.2 jop/java/tools/src/com/jopdesign/libgraph/struct/UnknownClassInfo.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/libgraph/struct/UnknownClassInfo.java.diff?r1=1.1&r2=1.2 (In the diff below, changes in quantity of whitespace are not shown.) Index: UnknownClassInfo.java =================================================================== RCS file: /cvsroot/stefant/jop/java/tools/src/com/jopdesign/libgraph/struct/UnknownClassInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- UnknownClassInfo.java 13 Jan 2008 20:29:32 -0000 1.1 +++ UnknownClassInfo.java 20 Jan 2008 03:00:18 -0000 1.2 @@ -19,6 +19,7 @@ package com.jopdesign.libgraph.struct; import java.io.IOException; +import java.io.OutputStream; import java.util.Collections; import java.util.Set; @@ -51,7 +52,8 @@ return null; } - public void writeClassFile(String filename) throws IOException { + public void writeClassFile(OutputStream outputStream) throws IOException { + throw new IOException("Writing not implemented."); } protected Set loadInterfaces() { 1.2 jop/java/tools/src/com/jopdesign/libgraph/struct/ClassInfo.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/libgraph/struct/ClassInfo.java.diff?r1=1.1&r2=1.2 (In the diff below, changes in quantity of whitespace are not shown.) Index: ClassInfo.java =================================================================== RCS file: /cvsroot/stefant/jop/java/tools/src/com/jopdesign/libgraph/struct/ClassInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- ClassInfo.java 13 Jan 2008 20:29:32 -0000 1.1 +++ ClassInfo.java 20 Jan 2008 03:00:18 -0000 1.2 @@ -21,7 +21,7 @@ import com.jopdesign.libgraph.struct.type.MethodSignature; import org.apache.log4j.Logger; -import java.io.IOException; +import java.io.*; import java.util.*; /** @@ -102,11 +102,35 @@ /** * write this class to a java class file. + * The directory will be created if it does not exist. * * @param filename the filename of the new file. * @throws IOException if the file could not be stored. */ - public abstract void writeClassFile(String filename) throws IOException; + public void writeClassFile(String filename) throws IOException { + + File file = new File(filename); + String parent = file.getParent(); + + if(parent != null) { + File dir = new File(parent); + + if(dir != null) + dir.mkdirs(); + } + + BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); + + writeClassFile(out); + } + + /** + * write this class to an outputstream. + * + * @param outputStream the outputstream to write to. + * @throws java.io.IOException if any error occurs during writing to the stream. + */ + public abstract void writeClassFile(OutputStream outputStream) throws IOException; /**
* find a method by a full method name as created by {@link com.jopdesign.libgraph.struct.type.MethodSignature#createFullName(String,String)} )
|
 |