package gui_Design;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.StringWriter;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
public class FinalTest {
static StringBuffer stringBuffer = new StringBuffer();
public static void main(String[] args) throws Throwable {
Uma();
}
static void Uma() throws Throwable
{
try {
File file = new File("C:/Users/Mahesh/Desktop/Ma.txt");
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String line;
while ((line = bufferedReader.readLine()) != null) {
// if (Integer.parseInt(line)<1)
//
// {
// stringBuffer.append(line+"\"+");
// stringBuffer.append("\n");
// }
//
stringBuffer.append("\""+line+"\"+");
stringBuffer.append("\n");
}
fileReader.close();
//System.out.println("Contents of file:");
System.out.println(stringBuffer.toString());
} catch (IOException e) {
e.printStackTrace();
}
VelocityEngine ve = new VelocityEngine();
ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
ve.init();
org.apache.velocity.Template t = ve.getTemplate( "gui_Design/SP_Template.vm" );
VelocityContext context = new VelocityContext();
context.put("output", stringBuffer.toString());
StringWriter writer = new StringWriter();
t.merge(context,writer);
System.out.println(writer);
}
}
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.StringWriter;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
public class FinalTest {
static StringBuffer stringBuffer = new StringBuffer();
public static void main(String[] args) throws Throwable {
Uma();
}
static void Uma() throws Throwable
{
try {
File file = new File("C:/Users/Mahesh/Desktop/Ma.txt");
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String line;
while ((line = bufferedReader.readLine()) != null) {
// if (Integer.parseInt(line)<1)
//
// {
// stringBuffer.append(line+"\"+");
// stringBuffer.append("\n");
// }
//
stringBuffer.append("\""+line+"\"+");
stringBuffer.append("\n");
}
fileReader.close();
//System.out.println("Contents of file:");
System.out.println(stringBuffer.toString());
} catch (IOException e) {
e.printStackTrace();
}
VelocityEngine ve = new VelocityEngine();
ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
ve.init();
org.apache.velocity.Template t = ve.getTemplate( "gui_Design/SP_Template.vm" );
VelocityContext context = new VelocityContext();
context.put("output", stringBuffer.toString());
StringWriter writer = new StringWriter();
t.merge(context,writer);
System.out.println(writer);
}
}
No comments:
Post a Comment