3
3rdshiftcoder
hi-
everytime i try to print out a newline character with writeBytes i get a
funny symbol
instead of a new line in my text file. what am i missing? i use java 1.5x
thanks for any assistance,
jim
package demolib;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.*;
import java.util.List;
import java.util.Iterator;
import java.io.*;
public class ResetVendor {
public static void write(DataOutputStream outStream, String text) {
try {
outStream.writeBytes(text +" "+ "\n");
}
catch (IOException ex) {
ex.printStackTrace();
}
}
public static void main(String[] args)throws IOException{
Transaction tx = null;
Session session = HibernateUtil.getSessionFactory().openSession();
DataOutputStream outFile = new DataOutputStream(new
FileOutputStream("file4.txt"));
try {
tx = session.beginTransaction();
Query query = session.createQuery("from Payeeor");
List books = query.list();
for (Iterator iter = books.iterator(); iter.hasNext() {
Payeeor vendor = (Payeeor) iter.next();
String s = vendor.getPayeepayor();
write(outFile,s);
//session.saveOrUpdate(vendor);
}
tx.commit();
} catch (HibernateException e) {
if (tx != null) tx.rollback();
throw e;
} finally {
session.close();
outFile.close();
}
}
}
everytime i try to print out a newline character with writeBytes i get a
funny symbol
instead of a new line in my text file. what am i missing? i use java 1.5x
thanks for any assistance,
jim
package demolib;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.*;
import java.util.List;
import java.util.Iterator;
import java.io.*;
public class ResetVendor {
public static void write(DataOutputStream outStream, String text) {
try {
outStream.writeBytes(text +" "+ "\n");
}
catch (IOException ex) {
ex.printStackTrace();
}
}
public static void main(String[] args)throws IOException{
Transaction tx = null;
Session session = HibernateUtil.getSessionFactory().openSession();
DataOutputStream outFile = new DataOutputStream(new
FileOutputStream("file4.txt"));
try {
tx = session.beginTransaction();
Query query = session.createQuery("from Payeeor");
List books = query.list();
for (Iterator iter = books.iterator(); iter.hasNext() {
Payeeor vendor = (Payeeor) iter.next();
String s = vendor.getPayeepayor();
write(outFile,s);
//session.saveOrUpdate(vendor);
}
tx.commit();
} catch (HibernateException e) {
if (tx != null) tx.rollback();
throw e;
} finally {
session.close();
outFile.close();
}
}
}