XML used by code generator

package com.gzcgxt.erp.test ;


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import org.junit.Test;

public class MapperXML {

@Test
public void test1() throws Exception {

String header
= newxml();

String footer
= old();

StringBuffer sb
=new StringBuffer();

sb.append(header).append(footer);

File f
=new File("d:/UserMapper.xml" );

FileOutputStream out
=new FileOutputStream(f);

out.write(sb.toString().getBytes());

out.close();

}


public String old() throws Exception
{
File f
=new File("c:/UserMapper.xml" );

FileInputStream in
=new FileInputStream(f);

byte[] buffer=new byte[1024];

int len=-1;

StringBuffer sb
=new StringBuffer();
while((len=in.read(buffer))!=-1)
{
String s
=new String(buffer,0,len);
sb.append(s);
}

in.close();

String[] arr
= sb.toString().split("");

return arr[1];

}


public String newxml() throws Exception
{
File f
=new File("e:/UserMapper.xml" );

FileInputStream in
=new FileInputStream(f);

byte[] buffer=new byte[1024];

int len=-1;

StringBuffer sb
=new StringBuffer();
while((len=in.read(buffer))!=-1)
{
String s
=new String(buffer,0,len);
sb.append(s);
}

in.close();

String[] arr
= sb.toString().split("");

String s
= arr[0];

s
=s+"";

return s;

}



}

package com.gzcgxt.erp.test;


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import org.junit.Test;

public class MapperXML {

@Test
public void test1() throws Exception {

String header
= newxml();

String footer
= old();

StringBuffer sb
=new StringBuffer();

sb.append(header).append(footer);

File f
=new File("d:/UserMapper.xml" );

FileOutputStream out
=new FileOutputStream(f);

out.write(sb.toString().getBytes());

out.close();

}


public String old() throws Exception
{
File f
=new File("c:/UserMapper.xml" );

FileInputStream in
=new FileInputStream(f);

byte[] buffer=new byte[1024];

int len=-1;

StringBuffer sb
=new StringBuffer();
while((len=in.read(buffer))!=-1)
{
String s
=new String(buffer,0,len);
sb.append(s);
}

in.close();

String[] arr
= sb.toString().split("");

return arr[1];

}


public String newxml() throws Exception
{
File f
=new File("e:/UserMapper.xml" );

FileInputStream in
=new FileInputStream(f);

byte[] buffer=new byte[1024];

int len=-1;

StringBuffer sb
=new StringBuffer();
while((len=in.read(buffer))!=-1)
{
String s
=new String(buffer,0,len);
sb.append(s);
}

in.close();

String[] arr
= sb.toString().split("");

String s
= arr[0];

s
=s+"";

return s;

}



}

Leave a Comment

Your email address will not be published.