Writing out to file - and it seems to overwrite data

I have written a program that reads in a file and then writes out XML. It works fine with small files but with files that are 1,310 kb it, seems to overwrite itself and i end up with a file that is missing its begining and middle pieces. I suspect that I am blowing out some buffer and a java component is reseting itself and overwriting the file, but i am scratching my head. Code below, please excuse the unformatted nature of the code.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class dl414image {
public static String all = "";
public static String fname = "";
public static String lname = "";
public static String mname = "";
public static boolean aflag = false;
public static boolean endofrec = false;
public static boolean bflag = false;
public static boolean cflag = false;
public static boolean dflag = false;
public static String xmldl;
public static String xmlreq;
public static String xml_issue_date;
public static String xml_first_name;
public static String xml_middle_name;
public static String xml_last_name;
public static String xml_dmvinfo;
public static String xmlbday;
public static String xmlsex;
public static String xmlheight;
public static String xmlweight;
public static String xmleyecolor;
public static String xmlhaircolor;
public static String xml_licenseclass;
public static String xml_licenseclassname;
public static String xml_licenseissuedate;
public static String xml_licenseexpiresdate;
public static String dlstart = "<dlnumber>";
public static String dlend = "</dlnumber>";
public static String xmlreqstart = "<requestor_code>";
public static String xmlreqend = "</requestor_code>";     
public static String issue_date_start = "<issue_date>";
public static String xml_issue_date_end = "</issue_date>";
public static int count = 0;
public static List<String> xml_abstractline = new ArrayList<String>();
public static List<String> xml_cline = new ArrayList<String>();
public static List<String> xml_dline = new ArrayList<String>();
public static List<String> xml_acontinuedline = new ArrayList<String>();
public static String dlold; // holds the previous DL number
public static final String HEX_EXP = "[\\xFF]";
public static final String CDATASTART = " <![CDATA[";
public static final String CDATAEND = "]]>";
public static String xmlfobates = "";
public static String xmltypeappdate = "";
public static String xml_licenseext;
public static String xml_licenserestrict;
public static String xml_licensedup;
public static String xml_licenseheld;
public static String xml_licenseseq;
public static List<String> xml_abstract_item = new ArrayList<String>();
public static List<String> xml_abstract_violationdate = new ArrayList<String>();
public static List<String> xml_abstract_convictdate = new ArrayList<String>();
public static List<String> xml_abstract_sectviolated = new ArrayList<String>();
public static List<String> xml_abstract_statute = new ArrayList<String>();
public static List<String> xml_abstract_file_number = new ArrayList<String>();
public static List<String> xml_abstract_location_or_arn = new ArrayList<String>();
public static List<String> xml_abstract_vehicle_license = new ArrayList<String>();
public static final String ABST = "ABST";
public static List<String> xml_reqNameAddress = new ArrayList<String>();
     /**<p>
     * This code reads in a file line by line
     * with BufferedReader and processes each
     * line.
     * @author Toren Valone
     public static void main(String[] args) {
          read("U:\\dlbig.txt"); //read this file
//     convenience method to encapsulate
//     the work of reading data.
     public static void read(String fileName) {
          xmlwriter("<?xml version=\"1.0\"?>");
          xmlwriter("<?xml-stylesheet type=\"text/xsl\" href=\"dl414.xsl\"?>" );
          xmlwriter("<dl_records>"); //write base element start tag
     try {
     BufferedReader in = new BufferedReader(
     new FileReader(fileName));
     String line;
     while ((line = in.readLine()) != null) {
          String cleanline = stripNonValidXMLCharacters(line);
     //our own method to do something
     handle(cleanline);
     //count each line
     count++;
     in.close();
     //show total at the end of file
     log("Lines read: " + count);
     } catch (IOException e) {
     log(e.getMessage());
     dlxmlwriter(); //final write for process
          xmlwriter("</dl_records>"); //write base element end tag
//     does the work on every line as it is
//     read in by our read method
     private static void handle(String line){
          if(line.length()> 0) {
          char fbyte = line.charAt(0);
          if(fbyte == 'A') {
          //just grab the very first dl
          if(count == 0) {
          dlold = line.substring(3,11);
          aflag = true;
          cflag = false;
          dflag = false;
          if(dlold.equalsIgnoreCase(line.substring(3,11))) {
          } else {
               dlxmlwriter();
          //create Drivers License XML
               xmldl = dlstart + line.substring(3,11) + dlend;
               //grab f.o bates no only if its there otherwise write empty xml
          xmlfobates = "<fobates>" + line.substring(12,19) + "</fobates>";
          //grab type app and date
          xmltypeappdate = "<typeappdate>" + line.substring(20,28) + "</typeappdate>";
               //Create Requestor code XML
          xmlreq = xmlreqstart + line.substring(51,56) + xmlreqend;
          //Create issue date XML
          xml_issue_date = issue_date_start + line.substring(57,63) + xml_issue_date_end;
          // clear name values, for now too stupid to figure out
          fname = "";
          mname = "";
          lname = "";     
          //Pulls the whole name string and sends it to namer function
          //to break up
          String name = line.substring(72);
          namer(name);
          //Create a string array and call get_Names which returns a
          //string array
          xml_first_name = "<first_name>" + fname + "</first_name>";
          xml_middle_name = "<middle_name>" + mname + "</middle_name>";
          xml_last_name = "<last_name>" + lname + "</last_name>";
               //store Dl for comparison
               store_old_dl(line);
          //Accent a and a length of 59 or 102 contains
          //the dmv info line
          if((fbyte == '?')& (line.length() == 59)){
               String cleandmvinfo = regexReplacer(line.substring(38,58),"//","");
               xml_dmvinfo = "<dmv_info_line>" + cleandmvinfo + "</dmv_info_line>";
          //Line length of 33 Birthdate, Sex, Height, Weight
          //Eye color hair color
          if ((line.length() == 33 ) & (aflag == true)) {
               xmlbday = "<birth_date>" + line.substring(3, 9) + "</birth_date>";
               xmlsex = "<sex>" + line.substring(11,12) + "</sex>";
               xmlheight = "<height>" + line.substring(14,17) + "</height>";
               xmlweight = "<weight>" + line.substring(18,21) + "</weight>";
               xmleyecolor = "<eye_color>" + line.substring(22,27) + "</eye_color>";
               xmlhaircolor = "<hair_color>" + line.substring(28,line.length()) + "</hair_color>";
//Line length of 35 Birthdate, Sex, Height, Weight
          //Eye color hair color
          if ((line.length() == 31     ) & (aflag == true)) {
               xmlbday = "<birth_date>" + line.substring(3, 9) + "</birth_date>";
               xmlsex = "<sex>" + line.substring(11,12) + "</sex>";
               xmlheight = "<height>" + line.substring(14,17) + "</height>";
               xmlweight = "<weight>" + line.substring(18,21) + "</weight>";
               xmleyecolor = "<eye_color>" + line.substring(22,27) + "</eye_color>";
               xmlhaircolor = "<hair_color>" + line.substring(28,31) + "</hair_color>";
// Line length of 56 Birthdate, Sex, Height, Weight
          //Eye color hair color for Annual reports
          if ((line.length() == 56     ) & (aflag == true)) {
               xmlbday = "<birth_date>" + line.substring(3, 9) + "</birth_date>";
               xmlsex = "<sex>" + line.substring(11,12) + "</sex>";
               xmlheight = "<height>" + line.substring(14,17) + "</height>";
               xmlweight = "<weight>" + line.substring(18,21) + "</weight>";
               xmleyecolor = "<eye_color>" + line.substring(22,27) + "</eye_color>";
               xmlhaircolor = "<hair_color>" + line.substring(28,31) + "</hair_color>";
          //If the line has an accent a and a length of 6
          if ((fbyte == '?')& (line.length() == 6)) {
          xml_licenseclass = "<license_class>" + line.substring(5,6) + "</license_class>";
          if ((fbyte == '?')& (line.length() == 8)) {
               String cleanlc = regexReplacer(line.substring(4,8),"&","&");
               xml_licenseclass = "<license_class>" + cleanlc + "</license_class>";
          if((line.length() == 61) & aflag==true) {
               xml_licenseclassname = "<license_class_name>" + line.substring(3,9) + "</license_class_name>";
               xml_licenseissuedate = "<license_issue_date>" + line.substring(9,16) + "</license_issue_date>";
               xml_licenseexpiresdate = "<license_expires_date>" + line.substring(16,23) + "</license_expires_date>";
               xml_licenseext = "<license_ext>" + line.substring(23,26) + "</license_ext>";
               xml_licenserestrict = "<license_restrict>" + line.substring(26,37) + "</license_restrict>";          
               xml_licensedup = "<license_dup>" + line.substring(38,43) + "</license_dup>";
               xml_licenseheld = "<license_held>" + line.substring(44,44) + "</license_held>";
               xml_licenseseq = "<license_seq>" + line.substring(57,61) + "</license_seq>";
          if(fbyte == 'B') {
               bflag = true;
               aflag = false; //ok got the a now turn switch off
               String cleanabstract = regexReplacer(line.substring(1,line.length()),HEX_EXP,"");
               cleanabstract = regexReplacer(cleanabstract,"&","&");
               cleanabstract = regexReplacer(cleanabstract,"&","&apos;");
          if(cleanabstract.substring(3, 7).equalsIgnoreCase("ABST")){
               if(cleanabstract.length() == 107) {               
                    xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,8) + "</abstract_item>");
               xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
               xml_abstract_convictdate.add("<abs_convict_date>" + cleanabstract.substring(15,21) + "</abs_convict_date>");
               xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
               xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,46) + "</abs_statute>");
               xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
               xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,99) + "</abs_location_or_arn>");
               xml_abstract_vehicle_license.add("<abs_vehicle_license>" + cleanabstract.substring(100,107) + "</abs_vehicle_license>");               
               if(cleanabstract.length() > 80 & cleanabstract.length() < 107) {               
                    xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,8) + "</abstract_item>");
               xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
               xml_abstract_convictdate.add("<abs_convict_date>" + cleanabstract.substring(15,21) + "</abs_convict_date>");
               xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
               xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,51) + "</abs_statute>");
               xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
               xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,cleanabstract.length()) + "</abs_location_or_arn>");
               if(cleanabstract.length() < 80) {
               System.out.println("****Change your assumtions about length*********");     
                    xml_abstractline.add("<abstract>" + cleanabstract + "</abstract>");
          if(cleanabstract.substring(3, 6).equalsIgnoreCase("ACC")){
               if(cleanabstract.length() < 107) {
                    System.out.println("Acc looks like!!!" + cleanabstract);
                    System.out.println("Acc length=" + cleanabstract.length());
               if(cleanabstract.length() > 102) {               
                         xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,6) + "</abstract_item>");
                    xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                    xml_abstract_convictdate.add("<abs_convict_date>" + " " + "</abs_convict_date>");
                    xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                    xml_abstract_statute.add("<abs_statute>" + " " + "</abs_statute>");
                    xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                    xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,99) + "</abs_location_or_arn>");
                    xml_abstract_vehicle_license.add("<abs_vehicle_license>" + cleanabstract.substring(100,cleanabstract.length()) + "</abs_vehicle_license>");               
               if((cleanabstract.length() > 77 ) & cleanabstract.length() < 102) {               
                         xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,6) + "</abstract_item>");
                    xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                    xml_abstract_convictdate.add("<abs_convict_date>" + " " + "</abs_convict_date>");
                    xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                    xml_abstract_statute.add("<abs_statute>" + " " + "</abs_statute>");
                    xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,cleanabstract.length()) + "</abs_file_number>");
                    xml_abstract_location_or_arn.add("<abs_location_or_arn>" + "</abs_location_or_arn>");
                    xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
          if((fbyte == ' ') & (bflag == true)) {
               String cleanabstract = regexReplacer(line.substring(1,line.length()),HEX_EXP,".");
               cleanabstract = regexReplacer(cleanabstract,"&","&");
               cleanabstract = regexReplacer(cleanabstract,"'","&apos;");
               if(cleanabstract.substring(3, 7).equalsIgnoreCase("ABST")){
                         if(cleanabstract.length() == 107) {               
                              xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,8) + "</abstract_item>");
                         xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                         xml_abstract_convictdate.add("<abs_convict_date>" + cleanabstract.substring(15,21) + "</abs_convict_date>");
                         xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                         xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,51) + "</abs_statute>");
                         xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                         xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,99) + "</abs_location_or_arn>");
                         xml_abstract_vehicle_license.add("<abs_vehicle_license>" + cleanabstract.substring(100,107) + "</abs_vehicle_license>");               
                         if(cleanabstract.length() > 93 & cleanabstract.length() < 107) {               
                              xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,8) + "</abstract_item>");
                         xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                         xml_abstract_convictdate.add("<abs_convict_date>" + cleanabstract.substring(15,21) + "</abs_convict_date>");
                         xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                         xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,51) + "</abs_statute>");
                         xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                         xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,cleanabstract.length()) + "</abs_location_or_arn>");
                         xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
               if(cleanabstract.substring(3, 6).equalsIgnoreCase("ACC")){
                         if(cleanabstract.length() > 102) {               
                                   xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,6) + "</abstract_item>");
                              xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                              xml_abstract_convictdate.add("<abs_convict_date>" + " " + "</abs_convict_date>");
                              xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                              xml_abstract_statute.add("<abs_statute>" + " " + "</abs_statute>");
                              xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                              xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,99) + "</abs_location_or_arn>");
                              xml_abstract_vehicle_license.add("<abs_vehicle_license>" + cleanabstract.substring(100,cleanabstract.length()) + "</abs_vehicle_license>");               
                         if((cleanabstract.length() > 77 ) & cleanabstract.length() < 102) {               
                                   xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,6) + "</abstract_item>");
                              xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                              xml_abstract_convictdate.add("<abs_convict_date>" + " " + "</abs_convict_date>");
                              xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                              xml_abstract_statute.add("<abs_statute>" + " " + "</abs_statute>");
                              xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,cleanabstract.length()) + "</abs_file_number>");
                              xml_abstract_location_or_arn.add("<abs_location_or_arn>" + "</abs_location_or_arn>");
                              xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
               if(cleanabstract.length() == 46) {
               if(cleanabstract.substring(22, 25).equalsIgnoreCase("CDL") & cleanabstract.length() == 46) {
               xml_abstract_item.add("<abstract_item>" + "</abstract_item>");
                    xml_abstract_violationdate.add("<abs_violation_date>" + "</abs_violation_date>");
                    xml_abstract_convictdate.add("<abs_convict_date>" + "</abs_convict_date>");
                    xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                    xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,cleanabstract.length()) + "</abs_statute>");
                    xml_abstract_file_number.add("<abs_file_number>" + "</abs_file_number>");
                    xml_abstract_location_or_arn.add("<abs_location_or_arn>" + "</abs_location_or_arn>");
                    xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
               if(cleanabstract.length()> 39 & cleanabstract.length() < 43     ) {
               if(cleanabstract.substring(22, 25).equalsIgnoreCase("DMV")) {
                    System.out.println("DMV length=" + cleanabstract.length());
                    xml_abstract_item.add("<abstract_item>" + "</abstract_item>");
                    xml_abstract_violationdate.add("<abs_violation_date>" + "</abs_violation_date>");
                    xml_abstract_convictdate.add("<abs_convict_date>" + "</abs_convict_date>");
                    xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,cleanabstract.length()) + "</abs_section_violated>");
                    xml_abstract_statute.add("<abs_statute>" + "</abs_statute>");
                    xml_abstract_file_number.add("<abs_file_number>" + "</abs_file_number>");
                    xml_abstract_location_or_arn.add("<abs_location_or_arn>" + "</abs_location_or_arn>");
                    xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
               xml_abstractline.add("<abstract>" + cleanabstract + "</abstract>");
          if(fbyte == 'C') {
               //turn b flag off
               aflag = false;
               bflag = false;
               cflag = true;
               String cleancomment = regexReplacer(line.substring(1,line.length()),HEX_EXP,"");     
               cleancomment = regexReplacer(cleancomment,"&","&");
               cleancomment = regexReplacer(cleancomment,"'","&apos;");
               xml_cline.add("<comment_line>" + cleancomment.substring(1,63) + "</comment_line>");
               xml_reqNameAddress.add("<requestor_name_or_address>" + cleancomment.substring(63,cleancomment.length()) + "</requestor_name_or_address>");
               System.out.println("In C code dl=" + xmldl + "aflag=" + aflag +"bflag=" + bflag + "cflag=" + cflag);           
          if((fbyte == ' ') & (cflag == true)){
               String cleancomment = regexReplacer(line.substring(1,line.length()),HEX_EXP,"");     
               cleancomment = regexReplacer(cleancomment,"&","&");
               if(cleancomment.length() > 63) {
          xml_reqNameAddress.add("<requestor_name_or_address>" + cleancomment.substring(63,cleancomment.length()) + "</requestor_name_or_address>");
          xml_cline.add("<comment_line>" + cleancomment.substring(1, 63) + "</comment_line>");
               } else {
                    xml_cline.add("<comment_line>" + cleancomment.substring(1, cleancomment.length()) + "</comment_line>");
          if(fbyte == 'D') {
               xml_dline.add("<action>" + line.substring(1, line.length()) + "</action>");
               dflag = true;
               cflag = false;
               System.out.println("In d code dl=" + xmldl + "aflag=" + aflag +"bflag=" + bflag + "cflag=" + cflag + "dflag=" + dflag);
          } // ends d if
          //If D line sets it to true then this will never run
          if((fbyte == ' ') & (dflag == true)) {
               xml_dline.add("<action>" + line.substring(1, line.length()) + "</action>");
          }     //end if line length greater than zero
     }// ends handle     
     public static void store_old_dl(String line) {
          dlold = line.substring(3,11);
     public static void dlxmlwriter(){
xmlwriter("<dl_record>");
     xmlwriter(xmldl);
     xmlwriter(xmlfobates);
     xmlwriter(xmltypeappdate);
     xmlwriter(xmlreq);
     xmlwriter(xml_issue_date);
     xmlwriter(xml_first_name);
     xmlwriter(xml_middle_name);
     xmlwriter(xml_last_name);
     xmlwriter(xml_dmvinfo);
     xmlwriter(xmlbday);
     xmlwriter(xmlsex);
     xmlwriter(xmlheight);     
     xmlwriter(xmlweight);
     xmlwriter(xmleyecolor);
     xmlwriter(xmlhaircolor);
     xmlwriter(xml_licenseclass);
     xmlwriter(xml_licenseclassname);
     xmlwriter(xml_licenseissuedate);
     xmlwriter(xml_licenseexpiresdate);
     xmlwriter(xml_licenseext);
     xmlwriter(xml_licenserestrict);
     xmlwriter(xml_licensedup);
     xmlwriter(xml_licenseheld);
     xmlwriter(xml_licenseseq);
     int a = 0;
     while (a < xml_abstractline.size()) {
          xmlwriter(xml_abstractline.get(a).toString());
          a++;
     int a1 = 0;
     while (a1 < xml_abstract_item.size()) {
          xmlwriter(xml_abstract_item.get(a1).toString());
          a1++;
     int a2 = 0;
     while (a2 < xml_abstract_violationdate.size()) {
          xmlwriter(xml_abstract_violationdate.get(a2).toString());
          a2++;
     int a3 = 0;
     while (a3 < xml_abstract_convictdate.size()) {
          xmlwriter(xml_abstract_convictdate.get(a3).toString());
          a3++;
     int a4 = 0;
     while (a4 < xml_abstract_sectviolated.size()) {
          xmlwriter(xml_abstract_sectviolated.get(a4).toString());
          a4++;
     int a5 = 0;
     while (a5 < xml_abstract_statute.size()) {
          xmlwriter(xml_abstract_statute.get(a5).toString());
          a5++;
     int a6 = 0;
     while (a6 < xml_abstract_file_number.size()) {
          xmlwriter(xml_abstract_file_number.get(a6).toString());
          a6++;
     int a7 = 0;
     while (a7 < xml_abstract_location_or_arn.size()) {
          xmlwriter(xml_abstract_location_or_arn.get(a7).toString());
          a7++;
     int a8 = 0;
     while (a8 < xml_abstract_vehicle_license.size()) {
          xmlwriter(xml_abstract_vehicle_license.get(a8).toString());
          a8++;
     int d = 0;
     while (d < xml_cline.size()) {
          xmlwriter(xml_cline.get(d).toString());
          d++;
     int e = 0;
     while (e < xml_dline.size()) {
          xmlwriter(xml_dline.get(e).toString());
          e++;
     int f = 0;
     while (f < xml_reqNameAddress.size()) {
          xmlwriter(xml_reqNameAddress.get(f).toString());
          f++;
     dflag = false;
     //writes the entag for dlnumber and dl record
xmlwriter("</dl_record>");
     xml_abstractline.clear();
     xml_cline.clear();
     xml_dline.clear();
     xml_abstract_item.clear();
     xml_abstract_violationdate.clear();
     xml_abstract_convictdate.clear();
     xml_abstract_sectviolated.clear();
     xml_abstract_statute.clear();
     xml_abstract_file_number.clear();
     xml_abstract_location_or_arn.clear();
     xml_abstract_vehicle_license.clear();
     xml_reqNameAddress.clear();
     public static void xmlwriter(String writestring){     
          String filename = "U:\\dl.xml";
               try {
                    FileWriter myFW = new FileWriter(filename, true);
                    BufferedWriter out = new BufferedWriter(myFW);     
out.flush();
                    out.write(writestring);
                    out.newLine();
                    out.close();
               } catch (IOException f) {
                    System.out.println("Error -- " + f.toString());
               }// ends catch
//     convenience to save typing, keep focus
     private static

Ok, here is the snippet that I think is having problems
static void xmlwriter(String writestring){
String filename = "U:dl.xml";
try {
FileWriter myFW = new FileWriter(filename, true);
BufferedWriter out = new BufferedWriter(myFW);
out.flush();
out.write(writestring);
out.newLine();
out.close();
} catch (IOException f) {
System.out.println("Error -- " + f.toString());
}// ends catch
I call this for everyline written, and as I watch the file bytes count up, I then see it reset to zero and start over. Could this be something to do with creating a new buffer for every line?

Similar Messages

  • TS1559 I tried all suggestions fo a grayed out wifi toggle and nothing seems to be working. Any other suggestions?

    I tried all suggestions fo a grayed out wifi toggle and nothing seems to be working. Any other suggestions?

    I had this problem last month.  I ended up having to get a new iPhone 4S.  It's a very, very common problem and in my opinion it should be covered by Apple for free since it is so popular and is an obvious hardware defect especially in the iPhone 4S.
    So I suggest you order a new iPhone ($230 with no warranty) ($50 with Apple Care+).  And while you wait for your new iPhone to come you could back up your iPhone and try some of the YouTube fixs.  I put mine in a plastic bag (off with no air in the bag) in the freezer for 30 minutes, pulled it out, turned it back on, let the iPhone thaw out in the bag, and it then worked again for over a week before it died again.  But I would only try that if you knew you had a new iPhone on the way.  My cellular, Wi-Fi, and Bluetooth all went out so I had nothing to lose.

  • New update are listed on the app icon. When I click update all I'm prompted to enter password. When I do, the progress bars go away and nothing gets updated. Tried logging out, reset iPad, and nothing seems to work. Keeps asking me to enter password.

    New update are listed on the app icon. When I click update all I'm prompted to enter password. When I do, the progress bars go away and nothing gets updated. Tried logging out, reset iPad, and nothing seems to work. Keeps asking me to enter password.

    I've been having the same problem for days and just solved it. Tried going to Apple ID and had all the same problems you did in the second paragraph. I signed out with my current username on the ipad under settings--->store and signed back in with my oldest apple id and password. Now the apps don't ask for a password to upgrade. I too had a username that wasn't an email address and had to change to one that was at some point. That's what caused the problems. Hope this can work for you.

  • Why do I get a NI-488 error massage when writing into a file and at the same time copiyng this file with a backup softwarre like Easy2Sync?

    I have a small LabVIEW program which writes random numbers very fast into a ASCII-file. I want that file to be copied to a new position every 10 min. Therefor I use a backup/synchronisation software which is doing a copy operation every 10 min. It works fine a certian amount of time and after a while I get either an LabVIEW error (LabVIEW: Fiel already open: NI-488 Comand requieres GPIB Controller to be System controller) or an backup-software error (couldn´t open file...whatever). I´m guessing, it has something to do with file-access but I don´t know why?!? If I run the LabVIEW program and I copy and paste the random-number-file with the windows explorer very fast (pressing ctrl+v rapidly) while LabVIEW is still writing into this file, no error appears. Can sombody help me?
    LabVIEW 2011

    Hi Serdj,
    you don't get a GPIB error, the error number has just 2 different explanations...
    Well, you have two programs accessing the same file. One program just wants to make a copy, the other (LabView) is trying to write to the file. When copying a file that is written to you get inconsistent results! That's why one of both programs is complaining an error...
    You can't have write and read access at the same time! (But you can have more than one read access at the same time...)
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • My documents on ipad 3 closes everytime I try to open it.it happened after I did an update last week.all my files and folders seem to be lost.how can I fix this?

    What can I do my documents keep closing when I tried to open it i have updated it last week and now it seems like it is not working.what cud the problem be?

    Can you start Firefox in [[Safe mode]] ?
    You can also do a clean reinstall and download a fresh Firefox copy from http://www.mozilla.com/firefox/all.html and save the file to the desktop.
    Uninstall your current Firefox version and remove the Firefox program folder before installing that copy of the Firefox installer.
    It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    You can initially skip the step to create a new profile, that may not necessary for this issue.
    See http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall

  • How can I open a tdms file and replace a subset of data then save that change without re-writing the entire file again?

    Hi all,
    Is it possible to open a tdms file and make a small change an an array subset then save the file without having to save the whole dataset as a different file with a new name? That is to say, is there something similar to "Save" in MS Word rather than "Save As"... I only want to change a 1D array of four data points in a file of 7M data points.
    I am not sure if this make sense? Any help is apreciated.
    Thanks,
    Jack

    You can use either one, but for your application, I would use the synchronous.  It requires far less setup.  When you open the file, set both enable asynchronous and disable buffering to FALSE to enable you to use synchronous with arbitrary data sizes.
    Attached code is LabVIEW 2011.
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    UpdateTDMS.zip ‏20 KB

  • Writing to a file and Reading from it "AT THE SAME TIME"

    Hello,
    If you have a vi (vi 1) that is generating and storing data to a file. Is it possible to write ANOTHER vi (vi 2) that reads & plots the data located at the same file (BTW, vi 1 will still store data to the file while vi 2 is reading the data)
    All I am trying to do is to plot data that is generated from a different vi (vi 1) somewhat in "real time". Unfortunately, I cannot access the vi (vi 1) that is generating the data and add a diagram to it. I have to build my own separate vi (vi 2).  Is this possible?
    Thanks in advance

    Once you open the file, you can't access it again until the original reference is closed. You might want to look at a functional global architecture. You use a case structure to determine how to access the data. Initialize, write, read, save are common examples of sections inside the functional global.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/D2​E196C7416F373A862568690074C759

  • When Firefox starts I get a msg "the instruction at "0 x 000000000 referenced memory at 0 x 000000000" The memory could not be "written" click on OK to terminate program. I x out of message and firefox seems to work. Should I worry about the message?

    I don't click on OK, just x out

    You can o a malware check with a few malware scan programs.<br />
    You need to use all programs because each detects different malware.<br />
    Make sure that you update each program to get the latest version of the database before doing a scan.<br />
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and [[Searches are redirected to another site]]

  • JSF - Read a text file and diplay lines of text data on the web page

    Hello,
    For one of my projects, I need to display lines of text data on the web page using Java Server Faces Technology. The raw data could be from simple text files or sockets or anything. (Getting the data is not my issue but displaying is). Could anybody send answers with sample code. In servlet, one could do this by -
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException{
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println(DATA);
    out.println(DATA);
    out.println("</html>");
    I am looking for similar solution.
    Thanks in advance
    DK

    Thanks mjolinor.  Works great!
    Two questions.
    1. Could you plz suggest how this could be modified so this code would read the file in or accept it from the pipeline instead of wrapping the (@' around the data?
    2. Could you plz briefly describe some of the details of the code so I can further research and understand.
    Thanks for your help.
    Thanks for your help! SdeDot
    1. It already reads in the file.  The (@' .. '@) bits are just there to create a file using your test data to demonstrate that it works.
    2.  Not user what kind of "details" you want.  There really isn't much there, and get-help on the cmdlets used should provide information on what's going on with them in that script.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Is it possible to find out what files have been burnt to a data CD in the past?

    I was trying to find what files I had sent someone a couple of months ago.  I thought it had been by email but I realise it must have been a CD.  I can't remember what I had sent them.  Does the Macbook have any history of CD burning?

    No. That's your responsibility.

  • HT4599 How do I upload photos from PC to icloud - loaded into upload file and does not seem to upload

    How do I upload photos from PC to icloud.  I have already moved photos to icloud upload file and nothing seems to upload.  jnelso1

    I have this problem too. Photo stream works fine on iPhone+iPad, but the photos are never loaded to my PC (Win 8.1). My shared folders works fine on iOS and PC, but not My photo stram.
    In the beginning, a couple of years ago, it work, but not now (2014).
    All iOS are updated, and PC-iCloud software/panel is Active, and Photo stream is activated.
    What to do??
    Reset all streams on PC? I tried, no result.
    I can understand that it takes time to reload all Pictures from iCload to my PC, but I wait Days, weeks...

  • 8g touch updated 4.2.1, problems synching apps and music. gives multiple errors; device times out, internal device errors, network times out, duplicate file, too many files open. itunes diagnostics ok. what to do?

    have an 8g ipod touch which has had problems trying to play games and downloading update 4.2.1. went to the apple store who kindly downloaded the software update but now can't synch and generates multiple error messages; device times out, internal device error, network times out, duplicate file and too many files open etc etc. have latest i tunes download and diagnostic test ok. what can i do?

    Does the ext directory have the php_oci8.dll? In the original steps the PHP dir is renamed. In the given php.in the extension_dir looks like it has been updated correctly. Since PHP distributes php_oci8.dll by default I reckon there would be a very good chance that the problem was somewhere else. Since this is an old thread I don't think we'll get much value from speculation.
    -- cj

  • Read multiple files and save all into one output file(AGAIN)

    Hi, guys
    I need your help for reading data from multiple files and save the results into one output file. When files are selected from file chooser, my program read the data line by line , do some calculations and save the result into the output. I made an array to store input files and it seems to be working fine, but when it comes to SaveFile() function, issues NullPointException message.
    public class FileReduction1 extends JFrame implements ActionListener
       // GUI definition and layout
        /* ACTION PERFORMED */
        public void actionPerformed(ActionEvent event) {
            if (event.getActionCommand().equals("Open File")) getFileName();
        /* OPEN THE FILE */
        private void getFileName() {
            // Display file dialog so user can select file to open
         JFileChooser fileChooser = new JFileChooser();
         fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            fileChooser.setMultiSelectionEnabled(true);
         int result = fileChooser.showOpenDialog(this);
         // If cancel button selected return
         if (result == JFileChooser.CANCEL_OPTION) return;
            if (result == JFileChooser.APPROVE_OPTION)
             files = fileChooser.getSelectedFiles();
                textArea.setText("");
                if(files.length>0)
                    filelist="";
                    System.out.println("files length"+files.length);
                    for(int i=0;i<files.length;i++)
                         System.out.println(files.getName());
    filelist+=files[i].getName()+" ,";
    if (checkFileName(files[i]) )
    openButton.setEnabled(true);
    readButton.setEnabled(true);
    textArea.append("file "+files[i].getName()+"is a proper file"+"\n");
    readFile(files[i]);
    textfield.setText(filelist);
    else{JOptionPane.showMessageDialog(this,"Please select file(s)",
                    "Error 5: ",JOptionPane.ERROR_MESSAGE); }
         // Obtain selected file
    /* READ FILE */
    private void readFile(File fileName_in) {
    // Disable read button
    readButton.setEnabled(false);
    // Dimension data structure
         getNumberOfLines(fileName_in);
         data = new String[numLines][4];
         // Read file
         readTheFile(fileName_in);
         // Rnable open button
         openButton.setEnabled(true);
    /* GET NUMBER OF LINES */
    /* Get number of lines in file and prepare data structure. */
    private void getNumberOfLines(File fileName_in) {
    int counter = 0;
         // Open the file
         openFile(fileName_in);
         // Loop through file incrementing counter
         try {
         String line = fileInput.readLine();
         while (line != null) {
         counter++;
              System.out.println("(" + counter + ") " + line);
    line = fileInput.readLine();
         numLines = counter;
    closeFile(fileName_in);
         catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error reading File",
                   "Error 5: ",JOptionPane.ERROR_MESSAGE);
         closeFile(fileName_in);
         System.exit(1);
    /* READ FILE */
    private void readTheFile(File fileName_in)
    // Open the file
    //int row=0;
    int col=0;
    openFile(fileName_in);
    System.out.println("Read the file");
    // Loop through file incrementing counter
    try
    String line = fileInput.readLine();
    while (line != null)
    boolean containsDoubles = false;
    double temp;
    String[] lineParts = line.split("\t");
    try
    for (col=0;col<lineParts.length;col++)
    temp=Double.parseDouble(lineParts[col]);
    data[row][col] = lineParts[col];
    containsDoubles = true;
    System.out.print("data["+row+"]["+col+"]="+lineParts[col]+" ");
    } catch (Exception e) {row=0; col=0; temp=0.0;}
    if (containsDoubles){ row++;}
    System.out.println();
    line = fileInput.readLine();
    catch(IOException ioException)
    JOptionPane.showMessageDialog(this,"Error reading File", "Error 5: ",JOptionPane.ERROR_MESSAGE);
    closeFile(fileName_in);
    System.exit(1);
    //System.out.println("length"+data.length);
    closeFile(fileName_in);
    process(fileName_in);
    /* CHECK FILE NAME */
    /* Return flase if selected file is a directory, access is denied or is
    not a file name. */
    private boolean checkFileName(File fileName_in) {
         if (fileName_in.exists()) {
         if (fileName_in.canRead()) {
              if (fileName_in.isFile()) return(true);
              else JOptionPane.showMessageDialog(null,
                        "ERROR 3: File is a directory");
         else JOptionPane.showMessageDialog(null,
                        "ERROR 2: Access denied");
         else JOptionPane.showMessageDialog(null,
                        "ERROR 1: No such file!");
         // Return
         return(false);
    /* OPEN FILE */
    private void openFile(File fileName_in) {
         try {
         // Open file
         FileReader file = new FileReader(fileName_in);
         fileInput = new BufferedReader(file);
         catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error Opening File",
                   "Error 4: ",JOptionPane.ERROR_MESSAGE);
         textArea.append("OPEN FILE\n---------\n");
         textArea.append(fileName_in.getPath());
         textArea.append("\n");
         //System.out.println("File opened successfully");
    /* CLOSE FILE */
    private void closeFile(File fileName_in) {
    if (fileInput != null) {
         try {
              fileInput.close();
         catch (IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error Opening File",
                   "Error 4: ",JOptionPane.ERROR_MESSAGE);
    System.out.println("File closed");
    private void process(File fileName_in) {
    //getNumberOfLines();
         //data = new String[numLines][3];
         // Read file
    double temp,temp1;
         //readTheFile();
    //System.out.println("row:"+row);
    //int number=data.length;
    //System.out.println(number);
    for (int i=0; i<row; i++)
    temp=Double.parseDouble(data[i][1]);
    sumx+=temp;
    temp1=Double.parseDouble(data[i][3]);
    sumy+=temp1;
    multixy+=(temp*temp1);
    square_x_sum+=(temp*temp);
    square_y_sum+=(temp1*temp1);
    //System.out.println("Sum(x)="+sumx);
    double tempup=(row*multixy)-(sumx*sumy);
    double tempdown=(row*square_x_sum)-(sumx*sumx);
    slope=tempup/tempdown;
    double tempbup=sumy-(slope*sumx);
    intb=tempbup/row;
    double tempside=(row*square_y_sum)-(sumy*sumy);
    double cordown=Math.sqrt(tempdown*tempside);
    corr=tempup/cordown;
    r_sqrt=corr*corr;
         textArea.append("Data for file"+ fileName_in.getName()+" have been processed successfully.");
         textArea.append("\n");
         textArea.append("Please enter output file name including extension.");
    System.out.println("number"+row);
    System.out.println("slope(m)="+slope);
    System.out.println("intecept b="+intb);
    System.out.println("correlation="+corr);
    System.out.println("correlation="+r_sqrt);
    saveFile();
    private void saveFile()
    textArea.append("SAVE FILE\n---------\n");
    if (openFile1())
         try {
              outputToFile();
    catch (IOException ioException) {
              JOptionPane.showMessageDialog(this,"Error Writing to File",
                   "Error",JOptionPane.ERROR_MESSAGE);
    private boolean openFile1 ()
         // search for the file path
    StringBuffer stringpath;
    title=textfield1.getText().trim();
    int temp=fileName_in.getName().length();
    int temp_path=fileName_in.getPath().length();
    int startd=(temp_path-temp);
    stringpath=new StringBuffer(fileName_in.getPath());
    stringpath.delete(startd, temp_path+1);
    //System.out.println("file-path="+temp_path);
    //System.out.println("length-file="+temp);
    path=stringpath.toString();
    fileName_out = new File(path, title);
    //System.out.println(file_out.getName());
    if (fileName_out==null || fileName_out.getName().equals(""))
         JOptionPane.showMessageDialog(this,"Invalid File name",
                   "Invalid File name",JOptionPane.ERROR_MESSAGE);
         return(false);
         else
    try
    boolean created = fileName_out.createNewFile();
    if(created)
    fileOutput = new PrintWriter(new FileWriter(fileName_out));
    fileOutput.println("File Name"+"\t"+"Slope(m)"+"\t"+"y-intercept(b)"+"\t"+"Coefficient(r)"+"\t"+"Correlation(R-Squared)");
    return(true);
    else
    fileOutput = new PrintWriter(new FileWriter(fileName_out,true));
    return(true);
    catch (IOException exc)
    JOptionPane.showMessageDialog(this,"Please enter the file name","Error",JOptionPane.ERROR_MESSAGE);
    return(false);
    private void outputToFile() throws IOException
    // Initial output
         textArea.append("File name = " + fileName_out + "\n");
         // Test if data exists
         if (data != null)
         fileOutput.println(fileName_in.getName() +"\t"+ slope+"\t"+intb+"\t"+corr+"\t"+r_sqrt);
    textArea.append("File output complete\n\n");
         else
    textArea.append("No data\n\n");
         // End by closing file
    initialcomp();
         fileOutput.close();
    private void initialcomp()
    slope=0.0;
    intb=0.0;
    corr=0.0;
    r_sqrt=0.0;
    sumx=0.0; sumy=0.0; multixy=0.0; square_x_sum=0.0; square_y_sum=0.0;
    for(int i=0;i<data.length;i++)
    for(int j=0;j<data[i].length;j++)
    data[i][j]=null;
    /* MAIN METHOD */
    public static void main(String[] args) throws IOException
         // Create instance of class FileChooser
         FileReduction1 newFile = new FileReduction1("File Reduction Program");
         // Make window vissible
         newFile.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         newFile.setSize(500,400);
    newFile.setVisible(true);
    Sorry about the long lines.
    As you can see, all input files saved in array called files, however when OpenFile1() function is called, it take input (fileName_in) as a single file not an array. I'm assuming this causes the exception.
    When there's muptiple inputs, program should take each file from getFileName() to outputToFile() sequentially.
    Does anybody have an idea to solve this?
    Thanks a lot!!

    you naming convention is confussing. you should follows Java naming convention..you have a getXXX but decalred the return type as "void"...get usully means to return something...
    your code is doing too much..and hard to follows..
    1. get the selected files
    for each selected file
    process the file and return the result
    write out the result.
    /** close the precious resource */
    public void closeResource(Reader in){
        if (in != null){
            try{ in.close(); }
            catch (Exception e){}
    /** get the total number of line in a file */
    public int getLineCount(File file) throws IOException{
        BufferedReader in = null;
        int lineCount = 0;
        try{
            in = new BufferedReader(new FileReader(file));
            while ((in.readLine() != null)
                lineCount++;
            return lineCount;
        finally{ closeResource (in);  }
    /** read the file */
    public void processFile(File inFile, File outFile) throws IOException{
        BufferedReader in = null;
        StringBuffer result = new StringBuffer();
        try{
            in = new BufferedReader(new FileReader(inFile));
            String line = null;
            while ((in.readLine() != null){
                .. do something with the line
                result.append(....);
            writeToFile(outFile, result.toString());
        finally{ closeResource (in);  }
    public void writeToFile(File outFile, String result) throws IOException{
        PrintWriter out = null;
        try{
            out = new PrintWriter(new FileWriter(outFile, true));  // true for appending to the end of the file
            out.println(result);
        finally{  if (out != null){ try{ out.close(); } catch (Exception e){} }  }
    }

  • Best way to stream lots of data to file and post process it

    Hello,
    I am trying to do something that seems like it should be quite simple but am having some difficulty figuring out how to do it.  I am running a test that has over 100 channels of mixed sensor data.  The test will run for several days or longer at a time and I need to log/stream data at about 4Hz while the test is running.  The data I need to log is a mixture of different data types that include a time stamp, several integer values (both 32 and 64 bit), and a lot of floating point values.  I would like to write the data to file in a very compressed format because the test is scheduled to run for over a year (stopping every few days) and the data files can get quite large.  I currently have a solution that simply bundles all the date into a cluster then writes/streams the cluster to a binary file as the test runs.  This approach works fine but involves some post processing to convert the data into a format, typically a text file, that can be worked with in programs like Excel or DIAdem.   After the files are converted into a text file they are, no surprise, a lot larger than (about 3 times) the original binary file size.
    I am considering several options to improve my current process.  The first option is writing the data directly to a tdms file which would allow me to quicly import the data into DIAdem (or Excel with a plugin) for processing/visualization.   The challenge I am having (note, this is my first experience working with tdms files and I have a lot to learn) is that I can not find a simple way to write/stream all the different data types into one tdms file and keep each scan of data (containing different data types) tied to one time stamp.  Each time I write data to file, I would like the write to contain a time stamp in column 1, integer values in columns 2 through 5, and floating point values in the remaining columns (about 90 of them).  Yes, I know there are no columns in binary files but this is how I would like the data to appear when I import it into DIAdem or Excel.  
    The other option I am considering is just writing a custom data plugin for DIAdem that would allow me to import the binary files that I am currently creating directly into DIAdem.  If someone could provide me with some suggestions as to what option would be the best I would appreciate it.  Or, if there is a better option that I have not mentioned feel free to recommend it.  Thanks in advance for your help.

    Hello,
    Here is a simple example, of course here I only create one value per iteration in the while loop for simplicity. You can also set properties of the file which can be useful, and set up different channels.
    Beside, you can use multiple groups to have more flexibility in data storage. You can think of channels like columns, and groups as sheets in Excel, so you see this way your data when you import the tdms file into Excel.
    I hope it helps, of course there are much more advanced features with TDMS files, read the help docs!

  • Problem writing object to file

    Hi everyone,
    I am creating an index by processing text files. No of files are 15000 and index is a B+ Tree. when all files processed and i tried to write it to the file it gives me these errors.
    15000 files processed.
    writing to disk...
    Exception in thread "main" java.lang.StackOverflowError
            at sun.misc.SoftCache.processQueue(SoftCache.java:153)
            at sun.misc.SoftCache.get(SoftCache.java:269)
            at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:244)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1029)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:380)
            at java.util.Vector.writeObject(Vector.java:1018)
            at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:380)
            at java.util.Vector.writeObject(Vector.java:1018)
            at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
    ..........can anyone point out the mistake im doing?
    thanks

    the B+ Tree is balanced and is perfectly working without writing to the file. and i am using default writeObject() method of ObjectOutputStream.
      try {
                                FileOutputStream   f_out   = new   FileOutputStream ("tree.idx");
                                ObjectOutputStream obj_out = new   ObjectOutputStream (new BufferedOutputStream (f_out));   
         for (int x = 0, l = files.length; x < l; x++) {
              ProcessTree(files[x].toString());
                    System.out.println("Writing main index to the disk...");
                    obj_out.writeObject (tree); 
                    obj_out.flush();
                    obj_out.close();
                    } catch (Exception e)
          System.out.println (e.toString ());
          System.out.println("Error Writing to Disk!");
        }

Maybe you are looking for