File Streams *creating Files without those pesky line breaks

Greetings Java Developers,
Basicly I would like to write a large block of data out to a file without any line breaks and end of line characters that most JAVA Output Streams include with each call to WRITE(); First I am using BYTE Output Streams in JAVA and two end of line bytes are written also!!!
It may be possible to use a Buffered File Stream with a Large Buffer about a Megabyte or so and FLUSH() the Stream all at once.
Any ideas or suggestions will be greatly appreaciated!
-chibi_neko

I have not had a problem writing bytes to file. The getStream call returns a FileOutputStream. Also note that the curly braces around 'i' really are square braces but I used them because square braces around I get reformatted in his post.
      * Write bytes to a file.
      @param Data Data to write to a file.
      @param file Destination file.
     public static void write(byte [][] Data, File file)
          try
               OutputStream out = getStream(file);
               for(int i = 0 ; i < Data.length ; i++)
                    out.write(Data{i});
               out.close();
          catch(IOException E)
               throw new Error(E.getMessage());
          catch(Exception e)
               throw new Error(e.getMessage());
     }the getStream method
FileOutputStream fw = new FileOutputStream(file.getPath(),append);

Similar Messages

  • When exporting XML files, I get forced line breaks before and after my xmltag

    hi everybody,
    as I said, i do a javascritp that exports xml files. First I clean up my text by removing every invisible characters with app.findpreferences. Nevertheless, my xml files is almost well formed beacause i got before and after each xmltag a forced line break. Somebody could explain to me why ?
    I don't use prettyIndent and prettyPrinting .
    Best regards
    Américo Pinto

    hi everybody,
    as I said, i do a javascritp that exports xml files. First I clean up my text by removing every invisible characters with app.findpreferences. Nevertheless, my xml files is almost well formed beacause i got before and after each xmltag a forced line break. Somebody could explain to me why ?
    I don't use prettyIndent and prettyPrinting .
    Best regards
    Américo Pinto

  • Search/replace in huge files without line breaks

    i need to search and replace in huge XML files not containing line breaks. i cannot load them to memory as a whole because of size and cannot write a simple GrepReader because the $%��*" legacy system exporting the files does not do line breaking
    plz help

    P.S.
    the files are looking similar to XML, they are not XML at all - thats the original reason i have to modify them, no parser will accept them. aka: plz do not suggest SAX-parsing...

  • Why Rich Text (HTML Only) format email introduces line breaks (paragraph marks) in the email body in html?

    A sentence in rich text (change in Options, Delivery format) appears as a single sentence in browser. But when I check the page source I see that sentence has been broken in to multiple lines. Why is this done? Isn't this a bug?
    When viewed in a browser or application that supports rich text this does not create any problem since the line breaks are not taken into account . But I am trying to extract the text from this html and display in a nonHTML application like notepad.
    Is this done on purpose?
    For eg.
    In browser - Honesty is the best policy
    In View HTML Source -
    Honesty
    Is the
    best
    policy.

    lets start at the beginning.
    There is no such thing as rich text email, unless it in internal corporate stuff like MS Exchange, Lotus notes etc. EMail on the internet is HTML or Plain Text.
    I have no options > delivery format in my settings. Is this something to do with Outlook perhaps?
    Then there is your image. All those MSO objects. They stand for Microsoft Office Objects and indicate the source of the HTML as being Outlook or at least Microsoft Office. All in all I think your asking about Microsoft actions on a Mozilla forum.

  • Cftextarea pdf copy/paste line breaks

    When I copy and paste from a pdf into cftextarea using the Paste as Word or Paste as Plain Text features, it adds line breaks to each line.  Has anyone had experience with this and know how to remove those extra line breaks at the time of pasting the text?
    ColdFusion 8

    Thanks, CtDave for the response. To follow up on your comment I've discovered a few things from this thread:copying from pdf comes out in single column
    This problem primarily happens when exporting/saving a PDF using Apple's native PDF processor, "Quartz," meaning whenever you use iWorks Pages, MS Word for Mac, or save a PDF via the Print dialogue, it will result in a PDF that doesn't comply to the standards CtDave outlined (presumably). One can mitigate this problem by opening the PDF in Preview vs. Adobe Reader or Acrobat—copy and pasting should work if its all in the Apple universe.
    Obviously thats not practical if one intends on producing documents for the masses. Alternatively, creating documents in Indesign would mitigate that problem but that involves expertise outside of traditional word processing.
    Thats all I got for now.
    Thanks,

  • How to not create File without any payload?

    Hi XI Experts,
    I have the following integration scenario:
    1.  One input file
    2.  One or more output files (up to four files)
    3.  At any given time, I could have one or more files (up to four files) filled with data in the payload.
    Question - there are times where only one file will have data in the payload and three files without any data in the payload (by design).  In this case, I do NOT want to create files that does not have any data in the payload.  Is there any way I can do this without BPM?  The output files that does not have any data in the payload is not going to be 0 byte as it will still have blank XML tags.
    Again, we do not want to use BPM if there is any way around it.  We are running XI 2004s SP7 (equivalent to 2004 SP16).  Any help would be greatly appreciate it.
    Here is the content of the ouput file WITHOUT any data in the payload:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:entity-data xmlns:ns0="urn:dow-com:xi:data:vendavo:10">
    </ns0:entity-data>
    Here is the content of the ouput file WITH data in the payload:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:entity-data xmlns:ns0="urn:dow-com:xi:data:vendavo:10">
        <com.Dow.customer.DCorporate>
            <VName>DCorporate</VName>
            <VLabel>013-ZZ</VLabel>
        </com.Dow.customer.DCorporate>
    </ns0:entity-data>
    Thanks,
    Jay

    Hi Jay..,
    You can achieve this without BPM too.Your input is one file,by doing the Multi Mapping (1: N) you can acheive this.If there is no payload for any of the four files means simply put your four message types occurences as 0..Unbounded.
    Check / Put an condition on your input file payload which field is determining whether data is containg for all or for some of the files.
    So, if your input file containg the data for four files, those files are would be populated otherwise the files are not getting populated.I guess there is no use to create the blank XML structure.
    Let me know your feedback.., It would be work for your case ..
    Cheers
    Tiger woods

  • Is there any way to create 3D PDF file without having the model tree ?

    Is there any way to create 3D PDF file without having the model tree ?
    3D communication is good but sometime we don't want the receiver to be able to study every components in model.
    or any way to make the receiver cannot use model tree and measurement tool ????
    Thank you very much

    You can remove the assembly tree by doing a roundtrip in 3D Toolkit, here's how:
    - start Acrobat 3D
    - drag & drop a CAD file
    - click on 3D Annot to activate
    - right-click on 3D
    - select 'Edit in 3D Toolkit'
    - 3D Toolkit launches
    - click in 'Scene Tree' panel
    - right-click on top assembly name
    - select 'Tools->Collapse Hierarchy'
    - select 'File->Save'
    - select 'File->Exit'

  • Creating a JButton for each line in a txt file

    I need to know how to creating a JButton for each line in a txt file then add an actionListener to the number of buttons (note they are in a JTable). Here is a clipet of code thanx for the help (note that this is one part of a program i am making there are 2 more classes. If u need them just ask) Thanx:
    class Diary extends JFrame implements ActionListener {
         private JTextArea note;
         private JTextField name;
         private JMenuBar menu = new JMenuBar();
         private JMenu file, edit, font, background, tcolor, settings, help;
         private JMenuItem nu, copy, paste, save, exit, b8, b10, b12, b14, b16, b18, b20, b24, b30, bblue, bred, bgreen, bpink, cblue, cred, cgreen, cpink, eset, nver, using, about;
         private String[] columnNames = {
              "File"
         private Vector dat = new Vector();
         private JTable filetable;
         public Diary() {
              setSize(new Dimension(500, 500));
              setTitle("Diary 2.00");
              file = new JMenu("File");
              menu.add(file);
              nu = new JMenuItem("new");
              nu.addActionListener(this);
              file.add(nu);
              file.add(new JSeparator());
              copy = new JMenuItem("copy");
              copy.addActionListener(this);
              file.add(copy);
              paste = new JMenuItem("paste");
              paste.addActionListener(this);
              file.add(paste);
              file.add(new JSeparator());
              save = new JMenuItem("Save");
              save.addActionListener(this);
              file.add(save);
              file.add(new JSeparator());
              exit = new JMenuItem("exit");
              exit.addActionListener(this);
              file.add(exit);
              edit = new JMenu("Edit");
              menu.add(edit);
              font = new JMenu("font");
              edit.add(font);
              b8 = new JMenuItem("8");
              b8.addActionListener(this);
              font.add(b8);
              b10 = new JMenuItem("10");
              b10.addActionListener(this);
              font.add(b10);
              b12 = new JMenuItem("12");
              b12.addActionListener(this);
              font.add(b12);
              b14 = new JMenuItem("14");
              b14.addActionListener(this);
              font.add(b14);
              b16 = new JMenuItem("16");
              b16.addActionListener(this);
              font.add(b16);
              b18 = new JMenuItem("18");
              b18.addActionListener(this);
              font.add(b18);
              b20 = new JMenuItem("20");
              b20.addActionListener(this);
              font.add(b20);
              b24 = new JMenuItem("24");
              b24.addActionListener(this);
              font.add(b24);
              b30 = new JMenuItem("30");
              b30.addActionListener(this);
              font.add(b30);
              background = new JMenu("background");
              edit.add(background);
              bblue = new JMenuItem("blue");
              bblue.addActionListener(this);
              background.add(bblue);
              bred = new JMenuItem("red");
              bred.addActionListener(this);
              background.add(bred);
              bgreen = new JMenuItem("green");
              bgreen.addActionListener(this);
              background.add(bgreen);
              bpink = new JMenuItem("pink");
              bpink.addActionListener(this);
              background.add(bpink);
              tcolor = new JMenu("text color");
              edit.add(tcolor);
              cblue = new JMenuItem("blue");
              cblue.addActionListener(this);
              tcolor.add(cblue);
              cred = new JMenuItem("red");
              cred.addActionListener(this);
              tcolor.add(cred);
              cgreen = new JMenuItem("green");
              cgreen.addActionListener(this);
              tcolor.add(cgreen);
              cpink = new JMenuItem("pink");
              cpink.addActionListener(this);
              tcolor.add(cpink);
              settings = new JMenu("Settings");
              menu.add(settings);
              eset = new JMenuItem("Edit Settings");
              eset.addActionListener(this);
              settings.add(eset);
              help = new JMenu("Help");
              menu.add(help);
              using = new JMenuItem("Using");
              using.addActionListener(this);
              help.add(using);
              about = new JMenuItem("About");
              about.addActionListener(this);
              help.add(about);
              help.add(new JSeparator());
              nver = new JMenuItem("new Versions");
              nver.addActionListener(this);
              help.add(nver);
              note = new JTextArea("");
              try {
                   BufferedReader filein = new BufferedReader(new FileReader("files.txt"));
                   String sfile;
                   while ((sfile = filein.readLine()) != null) {
                        //add buttons per each line of the txt file and show em
              catch (FileNotFoundException ioe) {
                   JOptionPane.showMessageDialog(null, "Iternal Error, contact [email protected] if the error persists", "", JOptionPane.WARNING_MESSAGE);
              catch (IOException ioe) {
                   JOptionPane.showMessageDialog(null, "Iternal Error, contact [email protected] if the error persists", "", JOptionPane.WARNING_MESSAGE);JOptionPane.showMessageDialog(null, "Iternal Error, contact [email protected] if the error persists", "", JOptionPane.WARNING_MESSAGE);
              String[][] data = new String[dat.size()][];
              for (int x = 0; x < dat.size(); x++) {
                   data[x] = (String[])dat.get(x);
              filetable = new JTable(data, columnNames);
              filetable.setPreferredScrollableViewportSize(new Dimension(100, 500));
              JScrollPane scrollpane = new JScrollPane(filetable);
              name = new JTextField("diary");
              JPanel main = new JPanel(new GridLayout(0, 1));
              getContentPane().add(note);
              getContentPane().add(name, BorderLayout.SOUTH);
              getContentPane().add(scrollpane, BorderLayout.WEST);
              setJMenuBar(menu);
         public void actionPerformed(ActionEvent e) {
              if (e.getSource() == nu) {
                   int nuask = JOptionPane.showConfirmDialog(Diary.this, "Are you sure you want to make a new entry?\nThis will erease any unsaved entry's!!");
                   if (nuask == JOptionPane.YES_OPTION) {
                        note.setText("");
                        note.setBackground(Color.WHITE);
                        note.setForeground(Color.BLACK);
              if (e.getSource() == copy) {
                   note.copy();
              if (e.getSource() == paste) {
                   note.paste();
              if (e.getSource() == save) {
                   try {
                        String sn = name.getText();
                    FileWriter outputStream = new FileWriter("saved/" + sn + ".txt");                            
                    setTitle("Diary 1.00 : " + sn);
                    outputStream.write(note.getText());
                    outputStream.close();
                catch(IOException ioe) {
                     System.out.println("IOException");
              if (e.getSource() == exit) {
                   int exitask = JOptionPane.showConfirmDialog(Diary.this, "Are you sure you want to exit? Any unsaved entries will be deleted");
                   if (exitask == JOptionPane.YES_OPTION) {
                        System.exit(0);
              if (e.getSource() == b8) {
                   note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),8));
              if (e.getSource() == b10) {
                   note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),10));
              if (e.getSource() == b12) {
                   note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),12));
              if (e.getSource() == b14) {
                   note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),14));
              if (e.getSource() == b18) {
                   note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),18));
              if (e.getSource() == b20) {
                   note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),20));
              if (e.getSource() == b24) {
                   note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),24));
              if (e.getSource() == b30) {
                   note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),30));
              if (e.getSource() == bblue) {
                   note.setBackground(Color.BLUE);
              if (e.getSource() == bred) {
                   note.setBackground(Color.RED);
              if (e.getSource() == bgreen) {
                   note.setBackground(Color.GREEN);
              if (e.getSource() == bpink) {
                   note.setBackground(Color.PINK);
              if (e.getSource() == cblue) {
                   note.setForeground(Color.BLUE);
              if (e.getSource() == cred) {
                   note.setForeground(Color.RED);
              if (e.getSource() == cgreen) {
                   note.setForeground(Color.GREEN);
              if (e.getSource() == cpink) {
                   note.setForeground(Color.PINK);
              if (e.getSource() == eset) {
                   new UserSettings().setVisible(true);
              if (e.getSource() == about) {
                   JOptionPane.showMessageDialog(null, "Created by Collin Doering 2005 in Gr.9\n\nErrors:\n------------------------------------------------------------------\n1. No File Encryption\n2. No user and password Encryption", "", JOptionPane.INFORMATION_MESSAGE );
              if (e.getSource() == nver) {
                   JOptionPane.showMessageDialog(null, "New Version |3.00| expected July, 2005\n\nNew Features\n----------------------------------------------\n1. File Encryption\n2. User File Encryption\n3. Full help dialog\n4. More Text changing features", "", JOptionPane.INFORMATION_MESSAGE);
              if (e.getSource() == using) {
                   JOptionPane.showMessageDialog(null, "Go ask Collin Doering\[email protected]", "", JOptionPane.INFORMATION_MESSAGE );
    THANK YOU

    so i still do not understand how i would create one
    button per each line in a txt flle then read in the
    file that the txt file specified.This assumes you know how many lines there are in the file.
    If not, modify as per my prior post
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Testing extends JFrame
      String[] linesInFile = {"Hello","World","Goodbye","Now"};
      JButton[] btn = new JButton[linesInFile.length];
      public Testing()
        setLocation(200,200);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JPanel jp = new JPanel(new GridLayout(0,1));
        for(int x = 0; x < btn.length; x++)
          btn[x] = new JButton(linesInFile[x]);//<---this would be where file.readLine() goes
          jp.add(btn[x]);
          btn[x].addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent ae){
              JOptionPane.showMessageDialog(getContentPane(),ae.getActionCommand());}});
        getContentPane().add(jp);
        pack();
      public static void main(String[] args){new Testing().setVisible(true);}
    }

  • How do I convert a .pub file into a PDF, 2 page spread without the dotted line down the center?  I can select 2 page view and cover page in 2 page view, but the dotted line shows up.  Thank you!!

    How do I convert a .pub file into a PDF, 2 page spread without the dotted line down the center?  I can select 2 page view and cover page in 2 page view, but the dotted line shows up.  Thank you!!

    Hi skt102711,
    I would like to inform you that acrobat doesn't support .epub to .pdf format conversion. Please browse this Link for more information : Supported file formats | Acrobat, Reader
    Regards,
    Rahul

  • Determining number of lines in a File without loading it to memory

    hello guys,
    I'm just wondering if there is a way to know the number of lines in a file without having to load the file entirely into memory and count the lines.
    in my project i have a restriction that says that i'm not allowed to load into memory more than 10 KB. i have to read the file block by block, say ten lines at a time.
    I actually did the second point which is reading the file 10 lines at a time, but still the total number of lines is still hard coded.
    thank you for your help !
    I

    ralfph wrote:
    hello guys,
    I'm just wondering if there is a way to know the number of lines in a file without having to load the file entirely into memory and count the lines.
    in my project i have a restriction that says that i'm not allowed to load into memory more than 10 KB. i have to read the file block by block, say ten lines at a time.
    I actually did the second point which is reading the file 10 lines at a time, but still the total number of lines is still hard coded.
    thank you for your help !
    ISo just read a line at a time, increase a counter, and don't save the line. As long as no one line is longer than 10 kB, you're fine.
    If it's possible for a line to be longer than 10 kB, then you'll have to read into a byte[] or char[] and iterate over it looking for end of line characters.

  • Creating Files without a dialog

    I am trying to create a "silent" temp file to buffer my data into. I use the open file vi from the file I/O and wire a unique name and start path, set the function to "create" and set the advisory boolean to false but I still get a pop-up dialog box (with all the information passed to the vi). I do not want this dialog to open an the boolean des not seem to make a difference. I am using LV7.0 and windows 2000 (but this has to work on XP as well). Why cant I get rid of the dialog box? The help file for this VI seems to imply that a false value to "advisory?" would solve my problem but it does not.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

    You say you wire a name and a start path? You should wire the full path for the file to the "path" input of the open file. If you only give a name and a start path, it acts as "I want to save here, preferably with this filename, but ask the user just in case". You need to give the full path (with name) to let the VI know exactly where you want the file (And how it's called).
    See the attached image.
    Hope this helps
    Shane.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
    Attachments:
    open file without dialog.png ‏10 KB

  • Is it possible to create a control file without the datafiles

    Hi All,
    Is it possible to create a control file without the datafiles?
    on any OS or DB version
    regards,
    sachin

    if I understand properly:
    - you have a script to recreate the controlfile
    - you have all of your database files backed up except your controlfiles
    This should work as this is how we sometimes refresh dev databases:
    1) restore the copies of the database files
    2) recreate the controlfile
    3) recover the database files to the desired point in time (if hot backup or archivelogs are available, otherwise, it would be as of the time of the backup)
    4) add temp files to temporary tablespace(s)
    The simpler solution would be to backup your controlfile at the same time as your datafiles (RMAN or o/s copy).
    I hope I understood your question properly.

  • Is it the case that I can't back up all my files (including those created with third party software) to iCloud as I did with iDisk?

    It seems as if icloud only wants me to save files to iCloud that I create with a few iCloud compatible apps (mail, pages, numbers, keynote). I used iDisk as an off-site back up for many of my most important files, including those created with 3rd party apps. Is it the case that I can no longer do that?

    There are a number of alternatives to iDisk for file storage, most of them much faster. This page examines some of them:
    http://rfwilmut.net/migrate3

  • Creating .swf from .fla file using ADT command line

    Dear Adobe Community and Moderators:
    Is it possible to use the ADT command line to directly compile an .fla file into an .swf file? Context: I have an app created in Flash Pro CS55 (6 months worth of work), but now found Adobe has dropped Flash Pro in favor of Flash Builder or Flex. I have some native extensions I want to use for iOS, but they require Air 3.1 to compile (swf-version=14) i.e. using the MessageUI framework in a static .a library for an Air app. Flash Pro CS55's top end limit seems to be swf-version=13 (Flash 11). Because of heavy investment in time and energy into our Air app in Flash Pro, it's not feasible to convert to Flex by end of week. I tried creating an .swc file, and taking the library.swf from that, but alas, a catch-22, Flash Pro CS55 only compiles to swf-version=13.
    Is there any way to either (a) directly compile my root .swf file (from the .fla file) using a command line (so I can use ADT from Air 3.1 SDK) or (b) some way I can marry a native extension I've found I can use on GitHub which is swf-version=14? Again, my issue is that I have to use Air 3.1 since only it supports iOS5.
    Any thoughts, suggestions, comments are highly appreciated (including if it's not possible to do what I'm trying to do).
    Thank you Adobe community in advance,
    Alex

    I have the exact same question, please respond if you hold the answer to this! mxmlc won't work for me since I have created too many assets within the fla already! Thanks!

  • Is it possible to create .ncd file without using MAX?

    Is it possible to create .ncd file without using MAX? I am trying to read the data given by hundreds of possible Arb. IDs on one of the CAN port without having to create it from the MAX.
    Thank you

    Hi,
    the NI-CAN driver software does not provide functions/VIs to generate
    *.ncd files. However the *.ncd file format is just plain XML (ASCII text). Take a
    look at the example.ncd file that gets installed with NI-CAN
    (<ProgramFiles>\National Instruments\NI-CAN\):
    <?xml version="1.0" encoding="UTF-8"?>
    <nican_config version="0.1">
    <saved>8/8/2005,17:58</saved>
    <message name="TransmissionFluids">
      <id extended="0">82</id>
      <dbc>C:\Program Files\National Instruments\NI-CAN\example.ncd</dbc>
      <conflicts>0</conflicts>
      <bytes>6</bytes>
      <interface>1</interface>
      <comment></comment>
      <channel name="ClutchPressure">
        <conflicts>0</conflicts>
        <bitfield start="0" bits="8" order="0" type="1"/>
        <linear_scaling factor="1.600000e+001"
    offset="0.000000e+000" max="4.000000e+003" min="0.000000e+000"
    default="0.000000e+000" unit="kPa"/>
        <comment></comment>
      </channel>
    </message>
    </nican_config>
    Thus, you could generate *.ncd files with simple file I/O. Having XML-specific file I/O functions simplifies this task.
    -B2k

Maybe you are looking for