Write to file in ansi

I want to write an arraylist to a text file and have the file encoded in ansi. I have found the only way to have the file encoded in ansi is to write strings to the file. I can't figure out how to cast my arraylist to strings, (which is what i think I must do).
Any help/suggestions are appreciated. Below is my code:
import java.io.*;
//This class writes the status to the Master.txt file upon radio button press
class Writer1{
     public Writer1(){
          System.out.println("writer1 has been called");
          try {
     OutputStream bout = new BufferedOutputStream(fout);
     OutputStreamWriter out = new OutputStreamWriter(bout,"ASCII");
               for(int i = 0; i < Chat6.arrList.size(); i++) {
                         //out.write(Chat6.arrList.get(i)) + "\n");//need to convert to string
                    System.out.println("writing array loop " +Chat6.arrList);
                    out.flush();
               out.close();
          } catch (IOException e) {
}

FileWriter? I've written it before -- FileWriter is just a convenient subclass
of OutputStreamWriter that folds in a FileOutputStream. Here is its
complete source code, minus comments:
package java.io;
public class FileWriter extends OutputStreamWriter {
    public FileWriter(String fileName) throws IOException {
        super(new FileOutputStream(fileName));
    public FileWriter(String fileName, boolean append) throws IOException {
        super(new FileOutputStream(fileName, append));
    public FileWriter(File file) throws IOException {
        super(new FileOutputStream(file));
    public FileWriter(File file, boolean append) throws IOException {
        super(new FileOutputStream(file, append));
    public FileWriter(FileDescriptor fd) {
        super(new FileOutputStream(fd));
}What's missing from FileWriter that exists in OutputStreamWriter is
the ability to choose a charset! And the OP (perhaps mistakenly) seems
hellbent on choosing ASCII.

Similar Messages

  • Can't read or write some files, internet is failing, youtube won't load, software I tried to install was in Slovenian, not dutch or english like in my systempreferences settings, pictures and files won't preview with spacebar, etc. Malware?

    Specs:
    iMac 10.8.5
    3,4 GHz Intel Core i7
    32 GB 1600 MHz DDR3
    Can't read or write some files, internet is failing, youtube won't load, security software I tried to install was in Slovenian, not dutch or english like in my systempreferences settings, pictures and files won't preview with spacebar and are randomly corrupted, when I entered something in the Youtube searchbar (when it was still working) it send me to a site with sexadds.
    I tried restart my iMac and when I was logged back in, my dock preferences were reset.
    Also tried to download some security software to check my Mac for malware, but when I did, I tried several, I got a notification that said something like 'dumpfiles (don't know if this is the right translation...) damaged'.
    I'm taking screenshots from all the weird notifications I get and even three quarters off the screenshots I took in the last three hours are already unreadable.
    It started this morning when I tried opening a Premiere Pro file on which I worked the night before.
    When I tried opening it, it said the file was damaged and could not be openend.
    I tried opening it with AE or importing the file in a new project but nothing helped.
    When I tried looking for autosaves, this is the really weird part, there were none.
    Even though there are autosaves from my other projects, this one was completely gone.
    It looked like the day before never happened on my computer.
    Also when I openend Premiere all the recent projects had been wiped.
    So at first I thought it was a Premiere Pro failure.
    But than, later on the day, I tried loading some RAW files from my compact flash card.
    This is where I would get an error (error -36) which said some data cannot be read or written.
    I tried importing the files with a view different technics, from dragging to importing via Lightroom and I succeeded with Image Browser.
    But when I tried moving the files to an other folder the same error occurred.
    While dealing with this issue I wanted to put on some soothing music on youtube.
    This is when the next weird thing occurred: youtube wasn't completely loading in Chrome. I refreshed a view times, checked the internet connection and still no difference.
    When I tried in Safari it did work but when I clicked enter on the searchbar in Youtube, a page with sexadds appeared (I didn't install AdBlock in Safari...).
    I read about this 'phishing' where you are redirected to a site were a possible malware installment can take place...
    I don't know if it's connected to any of the problems I've been having but I just never experienced this on a mac, I have been a Mac user for 10 years now.
    On top of it all, internet started working worse and worse and now it's not even working at all. I had to fill in the password over and over, normally it remembers.
    Just like my system preferences, all the preferences I had with Chrome where also reset.
    Also somewhere in between I got this notification: Mac OS X must restore library to run programs. Type your password to allow.
    To me this is all very weird and suspicious. I have clearly no idea what's going on. Could this be another sort of trojan horse or malware?
    Some background info which could be helpful for solving this mystery:
    two months ago the one year old Fusion Drive in my iMac just broke out of nowhere.
    I got it replaced by a qualified apple repair store.
    When I got my computer back, all the files where gone.
    I got on the internet without AdBlock installed yet.
    A game or whatever it was, can't clearly remember, got installed by accident.
    I deleted it immediately.
    Only two weeks later, I couldn't log in to my account. It didn't recognize my password and username. 
    So I brought my mac back to the store.
    Here the repair guy said it was a minor thing and he just needed to reconnect my account. He also mentioned he found a downloaded game name Sparta and it probably had something to do with the error.
    I asked him; could it be a virus? He replied no way.
    I don't know why I couldn't be a virus, just because it's a mac doesn't mean it cannot be done.
    So today I tried installing anti virus software (such as avast- was in a weird language looked like slovenian, clamxav - was in slovenian) but I couldn't install them.
    PLEASE help me! I don't know what to do anymore, I work fulltime and I need my computer, I have no time to bring it in for repair, are there other perhaps easier ways?
    Could this be the work of a virus or a malware? Or is it a disk permissions issue?

    It sounds like you may have multiple problems, but none of them are likely to be caused by malware.
    First, the internet-related issues may be related to adware or a network compromise. I tend to lean more towards the latter, based on your description of the problem. See:
    http://www.adwaremedic.com/kb/baddns.php
    http://www.adwaremedic.com/kb/hackedrouter.php
    If investigation shows that this is not a network-specific issue, then it's probably adware. See my Adware Removal Guide for help finding and removing it. Note that you mention AdBlock as if it should have prevented this, but it's important to understand that ad blockers do not protect you against adware in any way. Neither would any kind of anti-virus software, which often doesn't detect adware.
    As for the other issues, it sounds like you've got some serious corruption. I would be inclined to say it sounds like a failing drive, except it sounds like you just got it replaced. How did you get all your files back after the new drive was installed?
    (Fair disclosure: I may receive compensation from links to my sites, TheSafeMac.com and AdwareMedic.com, in the form of buttons allowing for donations. Donations are not required to use my site or software.)

  • How to to read/write GIf files (not animated)

    Hi,
         Is there a labview vi(s) that will read a gif file and display it and also that will wirte it? I am interested in non animated gifs.
         Louis

    Ben wrote:
    Well before Mike got carried away in this thread the answer to those questions was "NO".
    But if you check that thread you will see that Mike has already done half of the work (reading a gif).
    There is limited functionality for writing a GIFin LabVIEW, look in vi.lib\picture\gif.llb\Write GIF File.vi
    Message Edited by Phillip Brooks on 10-09-2008 04:24 PM
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Read PDF Formatted Spool and write PDF File to Application Server

    Hi Experts,
    After ECC 6.0, HR-W2 and W2C Form Spools are getting generated in PDF format.
    We have a requirement wherein we want to read the PDF Spool Programatically and write the PDF file to Application server (Using OPEN DATASET and CLOSE DATASET)
    PARAMETERS : p_spono LIKE tsp01-rqident.
    DATA: pdf_data type FPCONTENT.
    types: lt_pdf_table(1000) type x.
    data:  l_pdf_data type standard table of lt_pdf_table,
           l_pdf_line type lt_pdf_table,
           l_offset type i,
           l_len type i,
           p_file(100) VALUE '\sapout\DVH\pdf2.pdf'.
    *Read the spool content
    CALL FUNCTION 'FPCOMP_CREATE_PDF_FROM_SPOOL'
        EXPORTING
             i_spoolid = p_spono
             i_partnum = '1'
        IMPORTING
               e_pdf = pdf_data
    *         e_pdf_file = file
        EXCEPTIONS
             ads_error = 1
             usage_error = 2
             system_error = 3
             internal_error = 4
        OTHERS = 5.
    * Modify the spool  contents to prepare internal table
      l_len = xstrlen( pdf_data ).
      while l_len >= 1000.
        l_pdf_line = pdf_data+l_offset(1000).
        append l_pdf_line to l_pdf_data.
        add 1000 to l_offset.
        subtract 1000 from l_len.
      endwhile.
      if l_len > 0.
        l_pdf_line = pdf_data+l_offset(l_len).
        append l_pdf_line to l_pdf_data.
      endif.
    * GUI DOWNLOAD Works Fine
    * Now pdf contents is ready , lets store in local PC
    *CALL FUNCTION 'GUI_DOWNLOAD'
    *  EXPORTING
    *   filename                        = 'C:\Documents and Settings\Desktop\shital.pdf'
    *   filetype                        = 'BIN'
    *  TABLES
    *    data_tab                        = l_pdf_data.
    OPEN DATASET p_file FOR OUTPUT IN BINARY MODE.
    IF sy-subrc <> 0.
      MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
              ' Error opening file:'(Z03) p_file.
    ENDIF.
    LOOP AT l_pdf_data INTO l_pdf_line.
      TRANSFER l_pdf_line TO p_file.
    ENDLOOP.
    CLOSE DATASET p_file.
    IF sy-subrc <> 0.
      MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
              ' Error closing file:'(Z04) p_file.
    ENDIF.
    Currently as you can see I have commented out GUI_DOWNLOAD Function Module, But it works perfect when I try to Download file to Local Desktop.
    But when I try to pass the same Contents to Application server file and then try to open it by downloading file then it opens BLANK pdf file.
    As per requirements I should be able to write the file correctly on Application server and If I dowload it from there it should open PDF file correctly.
    Let me know if you require further details about the issue.
    Regards
    Shital
    Edited by: shital phadake on Apr 8, 2009 9:39 PM

    Thanks Selçuk for your reply and taking time for understanding the Issue,
    I went thru Functionality of the program you suggested but dont think it matches my requirement.
    Regards
    Shital

  • How to over write a file on server using Dataset

    Hello Experts,
    Iu2019ve trying to write a code to fetch data in my program and create a file on server. My program work fine. However every time I run my program it append data at the end of the tile which it created 1st time. I donu2019t want this to happen. I want to new record to print on this file or in other words I want it to over write the file. Here is my code of dataset part.
    open dataset file for appending in text mode encoding default.
    if sy-subrc ne 0.
      write:/ 'File Opening/Creation Error'.
        exit.
    endif.
    loop at ivbrk.
      clear record.
        move ivbrk-headr to record+1(1).
        move ivbrk-vbeln to record+3(10).
        move ivbrk-waerk to record+15(5).
        move ivbrk-knumv to record+22(10).
        move ivbrk-fkdat to record+34(8).
        move ivbrk-kunrg to record+43(10).
        move ivbrk-kunag to record+54(10).
          transfer record to file.
        loop at ivbrp where vbeln = ivbrp-vbeln.
         clear items.
          move ivbrp-items to items+1(1).
          move ivbrp-posnr to items+3(6).
          move ivbrp-fkimg to items+11(13).
          move ivbrp-vrkme to items+25(3).
          move ivbrp-meins to items+30(3).
          move ivbrp-ntgew to items+34(15).
          move ivbrp-brgew to items+50(15).
          move ivbrp-gewei to items+66(3).
            transfer items to file.
        endloop.
    endloop.
    close dataset file.
    Can please somebody tell me what change I should make to over write on this file?
    Thanks a lot in advance.
    Moderator message - Please use code tags around your code
    Edited by: Rob Burbank on Jan 12, 2010 5:08 PM

    Hey zero:
    open dataset file for appending in text mode encoding default.
    Probably because you're opening it for appending.
    Rob

  • Write to file(AVI) synchronizate data

    I receive a USB Camera signal and a CAN(Control Area Network) signal.
    I like two signal parallel displaying and write to file (one or more) and after read.
    I practise IMAQ AVI Write Frame.vi with DATA.
    I receive USB Camera signal around 15fps (but this is not constant). Two CAN messages receive 10ms/sec.
    (200 CAN messages per sec -> 1camera signal/14 messages: I make a queue. When receive a Camera signal, than in all queue data associated with the image to write).
    I make two loop:
    First: read USB Camera and save AVI with data
    Second: read CAN messages
    My problem is bottleneck CAN bus?
    (webcam_can2.vi)
    Attachments:
    CAN_AVI.llb ‏465 KB

    Hi
    For the VI in the attachment (from the CAN_AVI.llb) the
    problematic part is the  " call library function node" which is defined
    as the wecanusb.dll.
    What should be done ? How the input
    parameters should be processed to be outputted by the " call library
    function node"  block  ?
    thank you..
    Message Edited by HIDIR on 04-23-2009 03:43 PM
    Message Edited by HIDIR on 04-23-2009 03:44 PM
    Message Edited by HIDIR on 04-23-2009 03:47 PM
    Attachments:
    examine.doc ‏56 KB

  • Can't write cache file for while creating domain in soa 11.1.1.5 on HP-UX

    Hi,
    Installing SOA 11.1.1.5 on HP-UX and during domain creation/configuration I am getting the below errors
    **sys-package-mgr: can't write cache file for**
    and have lots of cache file errors for different packages
    Any idea what might be wrong and whats the cause of these errors and is it safe to ignore these errors if not what is the work arround. As I already looked at the below post but I don't find */var/tmp/wlstTemp* on my machine as suggested in the post below.
    SOA 11.1.1.5 install got can't write cache file
    So wondering if there's anything else I can do i.e. while creating or configuring a Domain pass some parameter to config.sh etc.
    Thanks

    Hi,
    I don't see python.cachedir in config.sh. Here is config.sh
    #!/bin/sh
    mypwd="`pwd`"
    # Determine the location of this script...
    # Note: this will not work if the script is sourced (. ./config.sh)
    SCRIPTNAME=$0
    case ${SCRIPTNAME} in
    /*)  SCRIPTPATH=`dirname "${SCRIPTNAME}"` ;;
      *)  SCRIPTPATH=`dirname "${mypwd}/${SCRIPTNAME}"` ;;
    esac
    # Set the ORACLE_HOME relative to this script...
    ORACLE_HOME=`cd "${SCRIPTPATH}/../.." ; pwd`
    export ORACLE_HOME
    # Set the MW_HOME relative to the ORACLE_HOME...
    MW_HOME=`cd "${ORACLE_HOME}/.." ; pwd`
    export MW_HOME
    # Set the home directories...
    . "${SCRIPTPATH}/setHomeDirs.sh"
    # Set the config jvm args...
    CONFIG_JVM_ARGS="${CONFIG_JVM_ARGS} -DCOMMON_COMPONENTS_HOME='${COMMON_COMPONENTS_HOME}'"
    export CONFIG_JVM_ARGS
    # Delegate to the main script...
    "${WL_HOME}/common/bin/config.sh" "$@"Thanks

  • Beginner question - Can't read nor write a file using NetBean...

    Hi ,
    I'm a beginner java programmer, I got trouble when it comes to read or write a file program..
    I tried 3 programs and all of them can't read the file I want to read, eventhought I have put the txt file in the same folder with my source code.
    here is the source code I got from some site
    import java.io.*;
    class FileReadTest {
    public static void main (String[] args) {
         FileReadTest f = new FileReadTest();
    f.readMyFile();
    void readMyFile() {
    DataInputStream dis = null;
    String record = null;
    int recCount = 0;
    try {
    File f = new File("mydata.txt");
    FileInputStream fis = new FileInputStream(f);
    BufferedInputStream bis = new BufferedInputStream(fis);
    dis = new DataInputStream(bis);
    while ( (record=dis.readLine()) != null ) {
    recCount++;
    System.out.println(recCount + ": " + record);
    } catch (IOException e) {
    // catch io errors from FileInputStream or readLine()
    System.out.println("Uh oh, got an IOException error! " + e.getMessage());
    } finally {
    // if the file opened okay, make sure we close it
    if (dis != null) {
         try {
    dis.close();
         } catch (IOException ioe) {
    I also have tried another from book , both of them give the same result, can't read the file...
    Please help me with this...
    Thank you very much

    To start with use the full path to the file
    i.e. File f = new File("c:\\the\\full\\path\\to\\your\\file\\mydata.txt"); // Assumes a Windows platform using the C drive
    Then check to make sure you fiel exists e.g. System.out.println("File exists = " + f.exists());
    You can even test to see if the file is readable but since you created the file this porbably is not required.

  • Trying to install itunes on my new windows 8 laptop and getting an error message cannot write to file?

    error message cannot write to file when trying to install itunes on windows 8 laptop.

    Hi Stacy,
    Welcome to Apple Support Communities.
    Take a look at the article below, it provides a lot of great tips that will resolve most iTunes installation issues.
    Issues installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/ht1926
    If you run into any issues, just reply with details about the step you're on and what you're seeing.
    -Jason

  • Lion server file sharing issue with windows API read/write ini file (GetPrivateProfileString)

    Hello,
    I try to config lion server as file server for a windows application we use at work. All other computers are windows 7 or XP, lion server is the only mac. I choose lion server because it's size, quality and personal love of apple products.
    10.7.2 lion server's samba file sharing works almost perfectly with all my windows machines, I can copy, delete, modify any text files or office files without any issue, but the most important windows application for my business doesn't work with samba file sharing. After some digging, I found it is because windows program can't read or write INI file stored on lion share. Windows API GetPrivateProfileString always returns empty if the INI file is store on lion share.
    You can download a small application for read/write windows INI file from codeproject.com to test this problem:
    http://www.codeproject.com/KB/files/ini.aspx
    I can open/edit the in file using any text editor without any problem. The only problem is with those windows APIs. ACL is turned on for my lion share and assigned "delete" rights to samba users.
    I install samba3 on the same server; it works perfectly with windows API. My windows program also works. Looks like there is something wrong with lion server's sambax.
    I'd prefer to use built-in samba even I have samba3 working. Built-in samba is very immature right now, but considered how young it is, I will give apple some time to make it mature.
    Does anyone have same issue or knows how to fix it?
    Thanks,
    Michael.

    All the memory is fine. The server rarely if ever goes down when there are only around 10-12 users connected. When there are 20+ users connected and working heavily it goes down often. When I say working heavily, I mean they are transferring huge files to the SAN (100GB+), sometimes 5 at a time per user, and there are a bunch of others who are reading large video files at a minimum of 220MB/sec from the SAN.
    Though this worked on Snow Leopard without any issues, Lion just doesn't seem to be able to handle it. The odd thing is, on Snow Leopard there was only a single 1GB ethernet connection to a NAS system, whereas with Lion we have a much more powerful machine with a 6-port 10GB ethernet card and a 4 lane 8GB fiber card to a true SAN. You would think that the newer scenario with Lion would handle far more users with ease.
    So far, very disappointing with regards to Lion's file serving performance.

  • How to write a file in unix server through oracle plsql code

    Hi All,
    My requirement is to create and write a file (any file for eg txt file) in unix box with in a specified directory through oracle plsql code.
    Oracle sits in windows server.
    using utl_file package we can create directory where oracle resides and write it there in oracle server in our case windows..
    But here we need to create,write a file but in unix server which is different server than where the oracle server resides..
    we are using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    Can any one one please help me out in this issue...
    Thanks in Advance.
    Prakash

    Mr Prakash,
    Why are you asking this question multiple times in every forum you can spell?
    Valid responses have been presented to you already two times.
    Can you explain why you can't follow them up, but continue to abuse this forum by repeating doc questions?
    Sybrand Bakker
    Senior Oracle DBA

  • Error writting to file:

    Error writting to file:
    C:\Config.Msi\e0cc87.rbf. Verify that you have access to that directory

    I had this exact same problem just now, trying to upgrade to 10.7.
    I even got that error msg when trying to UNINSTALL iTunes!
    After hours of frustration trying everyone's different suggestions, I downloaded Revo Uninstaller http://www.cnet.com.au/apps/revo-uninstaller-10610875/ which solved the problem.
    Use it to help uninstall iTunes and related software components in the following order and then restart your computer:
    iTunes
    QuickTime
    Apple Software Update
    Apple Mobile Device Support
    Bonjour
    Apple Application Support (iTunes 9 or later)
    Then you can install iTunes from scratch.
    Good luck

  • Configuration "use next available filename" in "write measurement file" function

    My project recording signal and saving using "Write to Measurement File" function. I want to perform record multiple segments signals should have configured option "use next available filename". For example, if the original file is data.tdms then it will save the file into: data_1.tdms, data_2.tdms, data_3.tdms, ...
    To do that I use a button control enable and disable write functionality.
    In the past I have done normally. Now, I can not make it anymore, now every write new data were add into one file created without the next new file as desired, it has almost become a option "Append to file".
    I use LabVIEW 2013
    Solved!
    Go to Solution.
    Attachments:
    write measurement file.vi ‏54 KB

    Hello ducta9,
    It looks like you currently have the Write to Measurement File Express VI configured to "save to one file" - this means that all data from a given session will be saved to the same file.  The file number will only be incremented once the application is restarted or the Reset Boolean input is set to True.  If you want to save to a series of files, select the "save to a series of files" option and configure the Express VI as needed to generate new files at intervals. 
    If you want to write variable-size chunks of data to a new file every time the user clicks the Enable button, you might be able to get away with just wiring a True constant to the Reset.  I would still recommend taking a look at the options available in the save to a series of files settings.
    Best Regards,
    Tom L.

  • Write to file taking too long.

    Hi,
    I have a peculiar problem . I have used state machine architecture to build my code. In one particular state i write the data accquired and strore the wave form graphs as jpegs on the disk.
    File open and close happen only once outside the while loop. I am using "Write FIle" vi to write the data. Data is first bundled into a cluster and then writte. I use "Write JPEG FIle" to store graphs as JPEGS.
    When i create the executable and run, the program stops here in this state for an indefinite amount of time. (sometimes 60 secs, 80 secs)
    and then continues. Multiple tests have confirem that the problem is either due to file write or JPEG write.
    Can anyone please tell me the cause of error
    what happens to all the pop ups (errors thrown by labview when running the program) when the program is converted ino an executable?
    Rgds
    Prithvi.

    Hi prithvi,
    I suppose you work on a windows system. Windows may buffer the contents of a folder to allow faster directory queries. So sometimes your access is granted very fast,
    sometimes not (= getting new directory listing)...
    It's always a good idea to have a well structured folder tree for your files. Why don't you use subfolders for each measurement? Why don't you use a subfolder for each new day/hour, depending of the number of measurements done it that time?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • I'm trying to download my Master CS6 onto a new hard drive because my old one crashed and I keep getting a message saying " Cannot write the file" or "I don't have permission to access the requested resource." ? What does this mean?

    I'm trying to download my Master CS6 onto a new hard drive because my old one crashed and I keep getting a message saying " Cannot write the file" or "I don't have permission to access the requested resource." ? What does this mean?

    Yes- it is a Mac. I went through adobes system requirements and re- downloaded supportive software. The notice seems to happen near the end of the down load with the messages above. I'll look into your suggestion. Thank you- appreciated.

Maybe you are looking for