Writing to file being read

Is it possible to write to the same file that is being read in java. For instance I am opening a file and padding every line so that ever line contains 100 characters. After I pad each line can I write it back to the source file or would I need to create a temporary file, delete the original, and rename the temporay file?
Nathan

would I need to create a
temporary file, delete the original, and rename the
temporay file?That would be it, yes.
Consider this: you read (say) bytes 1 to 79 from the file, that being the first line. You pad that to 100 bytes and write those back. Then you want to read the next line, which starts at byte 80. That is, it USED TO start at byte 80 until you overwrote it. Now it's garbage.

Similar Messages

  • Getting FMS to broadcast a media file being read via a named pipe.

    I know you can broadcast partial AVI videos due to it's format. What I want to do, is feed an avi file to fms which is being generated by software on the local machine. If I create a named-pipe(on windows), will I be able to feed an avi file to fms while it's being read?

    Thanks Balusc!!
    I have made use of your code to display PDF files in an IFRAME tag too!!! I just dint believe that this would be possible. Please just take a look at my JSP page.
    <h:form id="CaseLookUp">
         <%
         String path = request.getContextPath()+"";
         out.print(path);
         %>
    <iframe scrolling="auto" src="<%=path%>/imageServlet?file=D:\70-229 V5.pdf" width="80%" height="600" ></iframe>
         </h:form>

  • Is my whole file being read?

    Sorry about the size of this but I think I should supply all the code to help you..
    A text file contains 11 lines like this (separated by tabs)
    A2 WWP     BMW     535     Exec     12/12/03
    The first file calls the GUI file (shown later) and loads the 11 lines of the text file into an array. I think only one line is being loaded but am not sure because on test the output "...No such Vehicle..." from the focusLost method of the second file is displayed. Anyway here is the code and thanks!!
    import java.io.*;
    import java.util.StringTokenizer;
    public class CarDetailsReader{
         static Executive[] cd = new Executive[11];
         static int recordNumber=0;
         static String tabs = "\t";
         static String rN, man, mod, ty, motExp;
         public static void parseLine(String s){
         StringTokenizer st = new StringTokenizer(s, tabs);
         while(st.hasMoreTokens()){
         rN = st.nextToken();
         man = st.nextToken();
         mod = st.nextToken();
         ty = st.nextToken();
         motExp = st.nextToken();
         cd[recordNumber++] = new Executive(rN, man, mod, ty);
    public static void LoadArray(){
         FileReader carFile;
         BufferedReader carReader;
         try{
              carFile = new FileReader("cardetails.txt");
              carReader = new BufferedReader(carFile);
              while(carReader.ready()){
                   parseLine(carReader.readLine());
              carFile.close();
         catch(FileNotFoundException e){
              System.out.println("File not found");
              System.exit(1);
         catch(IOException e){
              System.out.println("Error reading file");
              System.exit(2);
    public static int FindCar(String regNum){
         for(int i=0; i < recordNumber; i++)
              if(cd.GetRegNumber() == regNum) return i;
         return -1;
    public static void main(String args[]){
         LoadArray();
         GuiApplication ga = new GuiApplication("Crazy Car Hire LTD Calculator");
         ga.setBounds(100, 100, 500, 300);
         ga.show();
    and the second file............
    import java.awt.*;
    import java.awt.event.*;
    public class GuiApplication extends Frame implements ActionListener, FocusListener{
         private TextField txtRegistration, txtNoOfDays;
         private Label lblCarDetails, lblTHC;
         private int recordNumber;
         private Car carType;
         public GuiApplication(String title){
              super(title);
              setBackground(Color.lightGray);
              addWindowListener(new WindowEventListener());
              setLayout(new FlowLayout(FlowLayout.RIGHT, 30, 10));
              Label lblRegistration = new Label("Enter Registration Number");
              add(lblRegistration);
              txtRegistration = new TextField("", 7);
              add(txtRegistration);
              txtRegistration.addFocusListener(this);
              lblCarDetails = new Label("");
              add(lblCarDetails);
              Label lblNoOfDays = new Label("Number of Hire Days");
              add(lblNoOfDays);
              txtNoOfDays = new TextField("", 3);
              add(txtNoOfDays);
              lblTHC = new Label("Total Hire Cost : ");
              add(lblTHC);
              Button calcHireCost = new Button("Get Total Cost");
              add(calcHireCost);
              calcHireCost.addActionListener(this);
    public void focusGained(FocusEvent e){
         txtRegistration.setText("");
         lblCarDetails.setText("");
         lblTHC.setText("Total Hire Cost : 0");
         show();
    public void focusLost(FocusEvent e){
         recordNumber = CarDetailsReader.FindCar(txtRegistration.getText());
         if(recordNumber >= 0)
              lblCarDetails.setText(CarDetailsReader.cd[recordNumber].toString());
         else
              lblCarDetails.setText("...No Such Vehicle!...");
         show();
    public void actionPerformed(ActionEvent e){
         String arg = e.getActionCommand();
         recordNumber = CarDetailsReader.FindCar(txtRegistration.getText());
         if("Get Total Cost".equals(arg) && recordNumber >= 0){
              if(CarDetailsReader.cd[recordNumber].GetType().equals("Exec"))
                   carType = new Executive(CarDetailsReader.cd[recordNumber].GetRegNumber(),
                        CarDetailsReader.cd[recordNumber].GetManufacturer(),
                        CarDetailsReader.cd[recordNumber].GetModel(), "Executive");
              else if
              (CarDetailsReader.cd[recordNumber].GetType().equals("Sup"))
                   carType = new Superior(CarDetailsReader.cd[recordNumber].GetRegNumber(),
                        CarDetailsReader.cd[recordNumber].GetManufacturer(),
                        CarDetailsReader.cd[recordNumber].GetModel(), "Superior");
              else
                   carType = new Classic(CarDetailsReader.cd[recordNumber].GetRegNumber(),
                        CarDetailsReader.cd[recordNumber].GetManufacturer(),
                        CarDetailsReader.cd[recordNumber].GetModel(), "Clas");
              double c = carType.CalculateSurcharge(Integer.parseInt(txtNoOfDays.getText()));
              lblTHC.setText("Total Hire Cost : " + c);
              show();
    Thanks again if you can help
    Mark

    The executive class is as follows:
    public class Executive extends Car {
    private double surcharge = 1.5;
    public double CalculateSurcharge(int noOfDays){
              return (46.5 * noOfDays) * surcharge;
    // Stereotype : <<constructor>>
    public Executive(String rN, String man, String mod, String ty){
              super(rN, man, mod, ty);

  • [SOLVED] bash and xterm - which files get read and referenced?

    I currently have my user shell set as /bin/sh (which, as I'm sure you are aware, is a symlink to bash). When I launch xterm, none of my config files seem to be read or sourced. If I login from the console, all is correct.
    According to the documentation I've read, when bash is invoked as sh, it should read /etc/profile, and then .profile, and finally .shrc (which is recommended to be explicitly sourced from .profile). I can see that /etc/profile is being read, as the PATH is being updated from items in /etc/profile.d, but none of my config files in ~ are being read.
    I put in a unique alias in each of .bash_profile, .bashrc, .profile, and .shrc to try to trace the files being read. In console, this reveals that .profile and .shrc are being read (as I would expect). But, in xterm, no aliases are being read.
    Also, PS1 is set to sh-4.2$ (literally set as '\s-\v\$ '). I have tried to grep that sequence in /etc, but that failed to hit on anything.
    I don't have my own .Xresources and nothing in .xinitrc redefines xterm behavior. The only switches I am explicitly sending to xterm redefine appearance (background/foreground color and font).
    The only other relevant piece of information I can think of is that I am using the slim login manager and in slim.conf it defines: login_cmd exec /bin/bash -login ~/.xinitrc %session. I changed that to /bin/sh, but it had no effect.
    Any ideas?
    Solution
    Adding
    XTerm*.LoginShell: True
    to ~/.Xdefaults will cause xterm to behave as expected.
    Last edited by archnet (2011-05-11 00:40:49)

    dmz wrote:
    To answer your actual question:
    strace -eopen xterm
    strace -eopen sh
    Here is the output:
    sh-4.2$ strace -eopen xterm
    open("/etc/ld.so.cache", O_RDONLY) = 3
    open("/usr/lib/libXft.so.2", O_RDONLY) = 3
    open("/usr/lib/libXaw.so.7", O_RDONLY) = 3
    open("/lib/libncursesw.so.5", O_RDONLY) = 3
    open("/lib/libc.so.6", O_RDONLY) = 3
    open("/usr/lib/libfontconfig.so.1", O_RDONLY) = 3
    open("/usr/lib/libX11.so.6", O_RDONLY) = 3
    open("/usr/lib/libXmu.so.6", O_RDONLY) = 3
    open("/usr/lib/libXt.so.6", O_RDONLY) = 3
    open("/usr/lib/libICE.so.6", O_RDONLY) = 3
    open("/usr/lib/libfreetype.so.6", O_RDONLY) = 3
    open("/usr/lib/libXrender.so.1", O_RDONLY) = 3
    open("/usr/lib/libXext.so.6", O_RDONLY) = 3
    open("/usr/lib/libXpm.so.4", O_RDONLY) = 3
    open("/usr/lib/libz.so.1", O_RDONLY) = 3
    open("/usr/lib/libexpat.so.1", O_RDONLY) = 3
    open("/usr/lib/libxcb.so.1", O_RDONLY) = 3
    open("/lib/libdl.so.2", O_RDONLY) = 3
    open("/usr/lib/libSM.so.6", O_RDONLY) = 3
    open("/usr/lib/libXau.so.6", O_RDONLY) = 3
    open("/usr/lib/libXdmcp.so.6", O_RDONLY) = 3
    open("/lib/libuuid.so.1", O_RDONLY) = 3
    open("/proc/meminfo", O_RDONLY) = 3
    open("/home/archnet/.Xauthority", O_RDONLY) = 4
    open("/home/archnet/.Xdefaults", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/lib/locale/locale-archive", O_RDONLY) = 4
    open("/usr/share/X11/locale/locale.alias", O_RDONLY) = 4
    open("/usr/share/X11/locale/locale.alias", O_RDONLY) = 4
    open("/usr/share/X11/locale/locale.dir", O_RDONLY) = 4
    open("/usr/share/X11/locale/en_US.UTF-8/XLC_LOCALE", O_RDONLY) = 4
    open("/home/archnet/.Xdefaults-natoufa", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.Xdefaults", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/X11/app-defaults/XTerm", O_RDONLY) = 4
    open("/etc/ld.so.cache", O_RDONLY) = 4
    open("/usr/lib/libXcursor.so.1", O_RDONLY) = 4
    open("/usr/lib/libXfixes.so.3", O_RDONLY) = 4
    open("/home/archnet/.icons/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/cursors/sb_h_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/cursors/sb_h_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/cursors/sb_h_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/cursors/sb_up_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/cursors/sb_up_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/cursors/sb_up_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/cursors/sb_down_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/cursors/sb_down_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/cursors/sb_down_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/cursors/sb_left_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/cursors/sb_left_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/cursors/sb_left_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/cursors/sb_right_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/cursors/sb_right_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/cursors/sb_right_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/dev/tty", O_RDWR) = 4
    open("/dev/ptmx", O_RDWR) = 4
    open("/home/archnet/.XCompose", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/X11/locale/compose.dir", O_RDONLY) = 5
    open("/usr/share/X11/locale/en_US.UTF-8/Compose", O_RDONLY) = 5
    open("/usr/share/X11/XKeysymDB", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/lib/gconv/gconv-modules", O_RDONLY) = 5
    open("/usr/share/terminfo/x/xterm", O_RDONLY) = 5
    sh-4.2$ strace -eopen sh
    open("/etc/ld.so.cache", O_RDONLY) = 3
    open("/lib/libreadline.so.6", O_RDONLY) = 3
    open("/lib/libncursesw.so.5", O_RDONLY) = 3
    open("/lib/libdl.so.2", O_RDONLY) = 3
    open("/lib/libc.so.6", O_RDONLY) = 3
    open("/dev/tty", O_RDWR|O_NONBLOCK) = 3
    open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
    open("/proc/meminfo", O_RDONLY) = 3
    open("/etc/nsswitch.conf", O_RDONLY) = 3
    open("/etc/ld.so.cache", O_RDONLY) = 3
    open("/lib/libnss_files.so.2", O_RDONLY) = 3
    open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
    open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/lib/gconv/gconv-modules", O_RDONLY) = 3
    open("/home/archnet/.bash_history", O_RDONLY) = 3
    open("/home/archnet/.bash_history", O_RDONLY) = 3
    open("/usr/share/terminfo/x/xterm", O_RDONLY) = 3
    open("/etc/inputrc", O_RDONLY) = 3
    I don't see it attempting to read any sort of profile for shrc file.

  • Adobe Reader Error Code 1310. Error writing to file: C:\ProgramFiles(x86)...

    I have been forced to Sumatra by some error in the system.  When I download Adobe Reader 10, during setup, it stops and produces an error window that says 'Error 131. Error writing to file:  C:\ProgramFiles(x86)\Adobe\Reader10.0\Esl\Aiodlite.dll. Verify you have access to that directory'...Retry? Cancel? Retry. Then continues then stops at 'Error 1310. Error writing to file.....Reader10.0\CoolType.dll. Verify that you.... then Retry again and it finishes. Then all Icons on my desktop become Adobe Icons. When I click on the 'Adobe reader 10.0 Icon it says "Adobe Reader could not open 'AcroRd32.exe' because it is either not a supported file type or the file has been damaged (for example , it was sent as an email attachment was not correctly decoded)." I have been through this many times with Internet Explorer and Safari with only minor differences as Safari doesn't give me the difficulties with the setup but does have the same effect. I have tried to go back to older versions of Adobe Reader..9.0 and 9.3 to the same end. The only thing I can think of is that I removed Zinio Reader 4, that was necessary for the online magazines that I get from Mother Earth News and others, but thought I was having difficulty due to it being the only recent addition to my PC. I think somehow it may have taken something with it. Anyway I'm an older not so computer literate entreprenuer that has been forced to this and man do I need help.

    http://forums.adobe.com/thread/800296?tstart=60

  • XML file not being read by Accordion Demo

    I had this working last week and it was a beautiful thing. I
    subsequently added many more product items to the products.xml file
    and resent it, now the products.xml file is not being read by the
    index page. I have read all the posts and added all the suggested
    fixes -
    added {useCache: false} to result in var dsProductFeatures =
    new Spry.Data.XMLDataSet("products.xml", "products/product[name =
    '{dsProducts::name}']/features/feature",{useCache: false})
    added <cfheader name="Cache-Control" value= "no-cache">
    <cfheader name="Expires" value="0">
    <cfheader name="Pragma" value="no-cache"> to header
    added var d = new Date();
    var cToday = d.getSeconds();
    var spryURL = "
    http://localhost:8500/SpryMe/Sample1/employees.xml?cacheBuster="
    + cToday; to header
    but my xml file is not being read. The script is running
    because the little fields on the right are moving.
    Any suggestions would be greatly appreciated!

    Hi,
    What's happening if you open the xml page (employees.xml)
    directly in browser. Are you able to see all the records? Is the
    XML valid?
    Regards,
    Dragos.
    PS: do you have a public URL where we can see that?

  • How to check if a file is being read by another program?

    Hey all,
    I just have a few question for a project I am doing:
    How do I check if a file is being read by another program?
    How do I check how many lines it read?
    How do I get Keyboard input from the user when he is using another program other than mine? Ex: Pressing Ctrl-G to take a screenshot.
    How can I halt another program from reading a file when it already opened it? Ex: The other program opened a file and began reading. Now it is at line 2 and I want to make it skip 10 lines and contontinue.
    Thanks,
    Bluelikeu

    How do I check if a file is being read by another
    program?This is about the only partially sensible question you asked. But the answer is that unless you use some native code, you can't.
    How do I check how many lines it read?It doesn't even make sense to ask this question. First of all, what's a "line" anyway? Files are just sequences of bytes. A "line" is only in the interpretation of those bytes, such as if it contains <cr><lf> sequences an application may choose to render the contents of those bytes as logical "lines" of string sequences. Second of all, why the heck would it matter to you how many bytes have already been read by some other process(es)?
    How do I get Keyboard input from the user when he is
    using another program other than mine? Ex: Pressing
    Ctrl-G to take a screenshot.You want to spy on other applications? Shame on you, Mr. Spyware creator.
    How can I halt another program from reading a file
    when it already opened it? Ex: The other program
    opened a file and began reading. Now it is at line 2
    and I want to make it skip 10 lines and contontinue.Shame on you Mr. Spyware creator.

  • Error1304. Error writing to file while trying to install Reader 8.1.2

    I get the following messages when trying to install Adobe Reader 8.1.2 for website.
    Error1304.Error writing to file c:\Program files\Adobe\Reader 8.0\Reader\AcroRd32.exe. Verify that you have access to that directory.
    Then it give me options to RETRY or CANCEL. When I retry it says the same thing.
    I have unistalled previous reader, restarting system then tried once again to install and still get the same error message.
    What do I need to do? It is unfortunate that many people are having issue of one kind or another downloading and installing the reader.
    Please help for I need this for working purposes.
    Carol

    Check whether the folder c:\Program files\Adobe\Reader 8.0\Reader
    exists. Does it exist?
    If so, look whether the file acrord32.exe exists in that folder. Does
    it exist? If so, try and delete it. Can you?
    If it doesn't exist. Try and create a file by that name. Can you?
    In each case, if you get an error message, what is it?
    Aandi Inston

  • File importer detected an inconsistency in the file stucture of (file name). Reading and writing this file's metadata (XMP) has been disabled.

    I have duplicated a project to work on another computer. The project opens fine but when I import new footage/audio files I get this message. "File importer detected an inconsistency in the file stucture of (file name). Reading and writing this file's metadata (XMP) has been disabled." Then I can't play my timeline and Premier Pro crashes.  I have to force quit and restart my computer to continue working. What does this error really mean? How do you rectify?
    Our workflow requires that we duplicate projects to make updates because we are frequently revising but need to keep original project unchanged and intact.

    I have a similar issue and message , but occurs when I import AVI clips from OnLocation CS4 to Premier Pro CS4.

  • Communication Channel marked all files as being read on FTP

    The Mailbox FTP has all the files flagged as being read when a single file is read through a communication channel.  I manually unflagged the status field so all files had a status of N so none were pulled.  I had 14 files for this test flagged as N.   I turned off all our CCu2019s.  I activated one that was pulling the last file in the list based on the Service Ref# which is unique file name.  I refreshed the dir of the FTP several times as the CC was running.  One by one as the flag was changed to Y (file read) from top to bottom.  It only took a second for each one until it got to three very large files and the status stopped while it was reading the file.  After a minute it continued to change the flag until it read the last one.   All 14 files on the ftp now had the status flag changed to Y.  It appears it actually read the file content one by one and set the flag until it was done.  Do you have any ideas why it would do this?  From a dos prompt I donu2019t have any of these issues so Iu2019m guessing itu2019s something unique in the SAP FTP adapter that is doing it?
    From a dos prompt I can successfully do a get 003520827870964903 c:data.txt and it will only update that ST flag for that one file as being read.  I can also do a get %EDT39A22%W_Z1JI4960 c:data.txt  and it will only flag the four files as being read that have that Mailbox/APRF value.  Now I'm trying to get my CC to do the same but no matter what I try it marks all six files as being read.   I have in my source directory %EDT39A22%W_Z1JI4960 and * for a file name and this will mark all files as being read when activated.   I have entered 003520827870964903 for a file name to further qualify and it still marks all files as being read.  It seems to be getting the file I want cause when I view the communication channel monitor it shows the right data in the payload but it always refers to another file for the archive / delete / test option from the processing tab.  There are no problems having a CC write a file out using similar parms for Mailbox/APRF, but trying to read a single file using the Service Ref # or a collection of files using a Mailbox/APRF mask seem to update the status for all files as being read.  Any suggestions are welcome.
    Mailbox ID           St    APRF                SNRF              Service Ref. #
    CMS                  N     CCR_GRIEF           filekh5LhC0000    003520599937481654
    CMS                  N     CLAIM_STLMNTS       fileza2TBr0004    003520769829611413
    EDT39A22             N     W_Z1JI4960          ileh3s0e60000     003520827846664146
    EDT39A22             N     W_Z1JI4960          fileUfXjR     003520827868994913
    EDT39A22             N     W_Z1JI4960          filePDFfKP0000    003520827870124419
    EDT39A22             N     W_Z1JI4960          fileQ7RFdR0000    003520827870964903
    Edited by: Kenbrown on Jul 28, 2011 9:10 PM
    Edited by: Kenbrown on Jul 28, 2011 9:13 PM

    Have you installed any apps that auto display the emails when they come in? If so the auto read feature may be triggering this, I had a app at one time that showed my emails in the preview window and it made the emails be listed as read... I would check your apps and make sure you are not using something like this unknowingly.

  • Reading/Writing .xlsx files using Webdynpro for Java

    Dear All
    I have a requirement to read/write excel files in .xlsx format. I am good in doing it with .xls format using jxl.jar. The jxl.jar doesn't support .xlsx format. Kindly help me in understanding how do I need to proceed on reading/writing .xlsx files using Webdynpro for Java.
    Thanks and Regards
    Ramamoorthy D

    i am using jdk 1.6.22 and IBM WebSphere
    when i use poi-3.6-20091214.jar and poi-ooxml-3.6-20091214.jar  to read .xlsx file. but i am getting following errors
    The project was not built since its classpath is incomplete. Cannot find the class
    file for java.lang.Iterable. Fix the classpath then try rebuilding this project.
    This compilation unit indirectly references the missing type java.lang.Iterable
    (typically some required class file is referencing a type outside the classpath)
    how can i resolve it
    here is the code that i have used
    public class HomeAction extends DispatchAction {
         public ActionForward addpage(
                             ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
                             throws Exception {     
                             String name = "C:/Documents and Settings/bharath/Desktop/Book1.xlsx";
               FileInputStream fis = null;
               try {
                   Object workbook = null;
                    fis = new FileInputStream(name);
                    XSSFWorkbook wb = new XSSFWorkbook(fis);
                    XSSFSheet sheet = (XSSFSheet) wb.getSheetAt(0);
                    Iterator rows = sheet.rowIterator();
                    int number=sheet.getLastRowNum();
                    System.out.println(" number of rows"+ number);
                    while (rows.hasNext())
                        XSSFRow row = ((XSSFRow) rows.next());
                        Iterator cells = row.cellIterator();
                        while(cells.hasNext())
                    XSSFCell cell = (XSSFCell) cells.next();
                    String Value=cell.getStringCellValue();
                    System.out.println(Value);
               } catch (IOException e) {
                    e.printStackTrace();
               } finally {
                    if (fis != null) {
                         fis.close();
                return mapping.findForward("returnjsp");

  • [svn] 1978: Bug: vendors. properties file which is used in vendor specific login commands was not being read properly and as a result some login related error messages were not being displayed correctly .

    Revision: 1978
    Author: [email protected]
    Date: 2008-06-06 08:05:34 -0700 (Fri, 06 Jun 2008)
    Log Message:
    Bug: vendors.properties file which is used in vendor specific login commands was not being read properly and as a result some login related error messages were not being displayed correctly.
    QA: Yes - we need automated tests to make sure that errors.properties and vendors.properties in BlazeDS/LCDS are loaded properly.
    Doc: No
    Modified Paths:
    blazeds/branches/3.0.x/modules/common/src/java/flex/messaging/util/PropertyStringResource Loader.java
    blazeds/branches/3.0.x/modules/opt/src/jrun/flex/messaging/security/JRunLoginCommand.java
    blazeds/branches/3.0.x/modules/opt/src/tomcat/flex/messaging/security/TomcatLoginCommand. java

    I have a lot of grief with this version of Windows Media Player.
    It is very buggy and frustrating to use.
    I have my Music library on a QNAP NAS, which is as reliable as they come.
    System notifications make it not save changes.  It also does not do a good job of interpreting albums and artists from folders.  Changes to track names are not saved, nor are tracks moved to other albums, renamed albums, changes to genre, artist
    or date.  It separates and merges albums/tracks without sense or reason.  Some changes I've made up to 4 times, then closed WMP and re-started my machine to check if it has/hasn't saved the changes.  Often it has not.
    This is the first time I've used WMP in this capacity, and I do not recommend it.
    New service pack please.

  • Special characters being read from the unicode file for greek language

    Hi All,
    I have a report which would upload a unicode file and then update the vendor master data accordingly.
    The file contains greek characters too.
    when the file is being read in the code, some special characters are being added up to the vendor number which is the first entry. The special characters are not included in the file , but are added up only to the first vendor number and not any other vendor numbers.
    The logic that is being used is as follows :
    TRY.
          IF unicode IS INITIAL.
            IF codepage IS INITIAL.
    *-->      For backward compatibility where this FM might be called from
    *         other dependent objects (FMs/dynamic subroutines)
    *         which donot have access to  user's input w.r.t Unicode parameters
              OPEN DATASET filename FOR INPUT
                   IN LEGACY TEXT MODE
                   MESSAGE msg
                   REPLACEMENT CHARACTER repl_char
                   IGNORING CONVERSION ERRORS
                   FILTER filter.                         
            ELSE.
    *--> System in non-unicode and Unicode Environment (Phases I and II)
              OPEN DATASET filename FOR INPUT
                   IN LEGACY TEXT MODE CODE PAGE codepage MESSAGE msg
                   REPLACEMENT CHARACTER repl_char
                   IGNORING CONVERSION ERRORS
                   FILTER filter.                          
            ENDIF.
          ELSE.
    *-->  Extract File in Unicode format - Phase III
            OPEN DATASET filename FOR INPUT IN TEXT MODE ENCODING UTF-8
            MESSAGE msg
            FILTER filter.                                 
          ENDIF.
          IF sy-subrc NE 0.
            MESSAGE e001(zuni) WITH filename sy-subrc
             RAISING file_open_error.
          ENDIF.
    the unicode parameters used are : codepage = 8000.
    An early reply is most appreciated.
    Regards,
    Manu.

    Please check SAP notes for Eastern European Characters in Unicode system. and may be below code helps you
    DATA:
        ltp_bom                  TYPE sychar01,
        ltp_encoding             TYPE sychar01,
        ltp_codepage             TYPE cpcodepage.
    Processing --------------------------------------------------------- *
      TRY.
          CALL METHOD cl_abap_file_utilities=>check_utf8
            EXPORTING
              file_name         = itp_filename
              max_kb            = -1
              all_if_7bit_ascii = abap_true
            IMPORTING
              bom               = ltp_bom
              encoding          = ltp_encoding.
        CATCH cx_sy_file_open .
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                  RAISING file_open_error.
        CATCH cx_sy_file_authority .
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                  RAISING file_authority_error.
        CATCH cx_sy_file_io .
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                  RAISING file_io_error.
      ENDTRY.
      CASE ltp_encoding.
        WHEN cl_abap_file_utilities=>encoding_utf8
          OR cl_abap_file_utilities=>encoding_7bit_ascii.
          CASE ltp_bom.
            WHEN cl_abap_file_utilities=>no_bom.
              OPEN DATASET itp_filename FOR INPUT IN TEXT MODE
                ENCODING UTF-8.
            WHEN cl_abap_file_utilities=>bom_utf8.
              OPEN DATASET itp_filename FOR INPUT IN TEXT MODE
                ENCODING UTF-8
                  SKIPPING BYTE-ORDER MARK.
            WHEN cl_abap_file_utilities=>bom_utf16_be.
              ltp_codepage = '4102'.
              OPEN DATASET itp_filename FOR INPUT IN LEGACY BINARY MODE
                BIG ENDIAN CODE PAGE ltp_codepage.
            WHEN cl_abap_file_utilities=>bom_utf16_le.
              ltp_codepage = '4103'.
              OPEN DATASET itp_filename FOR INPUT IN LEGACY BINARY MODE
                LITTLE ENDIAN CODE PAGE ltp_codepage.
            WHEN OTHERS.
              OPEN DATASET itp_filename FOR INPUT IN TEXT MODE
                ENCODING UTF-8.
          ENDCASE.
        WHEN OTHERS.
          OPEN DATASET itp_filename FOR INPUT IN LEGACY TEXT MODE.
      ENDCASE.
    Edited by: Nilesh Shete on May 7, 2010 5:29 PM

  • OIP-04907: LOB operation failed. Error reading or writing to file'

    I wrote a VB program who read and write blob
    I received this error
    OIP-04907: LOB operation failed. Error reading or writing to file'
    do you have an idea why
    or
    where Can I find some info about this error (OIP)
    thanks

    Hello SteveMRG,
    What version of LabVIEW and NI DAQmx are you using? Does this error occur when the program is run from the development PC from the project? Can you create a debuggable executable and activate Highlight execution when the error occurs as to verify which state the program is in?
    Wear
    National Instruments
    Product Support Engineer

  • Reading and writing to file , getting null when i try to  read file content

    i start by apologizing incase i have posted this question in the wrong forum
    i am trying to iterate through a directory tree and pick all the subdirectories and put them in an arraylist . on the other hand , i am picking all the files and putting them in a different arraylist . After that i iterate through the arraylist , pick a folder , create a file in it search for all the files of the same type in its subfolders and write them to the newly created file
    The problem i am running into is i i can't read the files and hence i can't write to the file .
    My directory tree is in the format
    c:\KPCData\\01\01\01\01\01\ file1_type1
    c:\KPCData\\01\01\01\01\02\ file2_type1
    where one one of the types is "covers" . i know this could be asking too much but i am at my tethers end , could someone please have a look at the code and tell me where i might be going wrong . you could zero in on the part where i have ************ before the a line of code thank you package directories;
    import java.io.*;
    import java.util.*;
    public class Directories {
    private static  ArrayList direcs= new ArrayList();
    private static  ArrayList census= new ArrayList();
    private static ArrayList vagrant= new ArrayList();
    private static ArrayList hotel= new ArrayList();
    private static ArrayList emigrant= new ArrayList();
    private static ArrayList traveller= new ArrayList();
    private static ArrayList longform= new ArrayList();
    private static ArrayList cover= new ArrayList();
    private static String parentPath = null;
    private static File mycover = null;
    private static File mytravel = null;
    private static File myemigrant = null;
    private static File mylong= null;
    private static File myinstitution = null;
    private static File myvagrant = null;
    private static BufferedReader in;
    private static BufferedWriter out;
    private static String read,toread;
    //function for listing the folder contents
    class compareDirs implements Comparator
    public int compare(Object one, Object two)
         int val=0;
         File file1 = (File)one;
         File file2= (File)two;
         String name1 = file1.toString();
         String name2= file2.toString();
         if (name1.length()==name2.length())
         val= name1.compareTo(name2);
         else
              if( name1.length()>name2.length())
                   val=-1;
              if (name1.length()<name2.length())
                   val=1;
         return val;
    private  ArrayList recurs(File dir,File file) throws IOException
         File []files=dir.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   recurs(files[index],file);          
              }//if
              else
                  census.add(files[index]);     
         }//for index
         return census;
    } //recurs
    //function for determining the number and paths of the folders
    private ArrayList numDirs(File dirs)
         File []files=dirs.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   if (direcs.contains(files[index])==false)
                   direcs.add(files[index]);
                   numDirs(files[index]);     
              }//if
         }//for index
         return direcs;
    public static void main(String[]args) throws IOException
              File myfile = new File("C:\\KPCData");
         File myfile2= new  File("C:\\KPCData\test.txt");
         Directories dir = new Directories();
         if (myfile.isDirectory())
         ArrayList myList=dir.recurs(myfile,myfile2);
         ArrayList mydir1 = dir.numDirs(myfile);
        ArrayList mydirs = new ArrayList();
        mydirs.add(mydir1.get(0));
         for (int x=0;x<mydir1.size();x++)
         {  int count=0;
              for (int y=0;y<mydirs.size();y++)
                   if (x==y)
                        count++;
              if (count<1)
                   mydirs.add(mydir1.get(x));
         Collections.sort( mydirs,dir.new compareDirs() );     
            for(int index1 =0 ;index1<mydirs.size();index1++)//print out directories
              File mydir=(File)mydirs.get(index1);
              File directory= (File)mydirs.get(index1);
              if(!mydir.getPath().contains("00"))//// if not leave node  create files for each file type
                   String name1 =mydir.getPath();
                   ArrayList ray=new ArrayList();
                   String name="K";
                 for (int index=0;index<name1.length();index++ )
                          if (name1.charAt(index)!='\\'&&name1.charAt(index)!='C'&&name1.charAt(index)!=':'&&name1.charAt(index)!='K'&&name1.charAt(index)!='P'&&name1.charAt(index)!='D'&&name1.charAt(index)!='a'&&name1.charAt(index)!='t')
                       name =name+(String.valueOf(name1.charAt(index)));
              // create a string
                  name= name.substring(1);
                   String trial = name+"_cover.dat";
                   mycover = new File ( mydir,trial);
                     if (mycover.exists()) {
                          mycover.delete();
                          mycover.createNewFile();
                      } else {
                           mycover.createNewFile();
                     String addit = mydir.getParent().toString();
                    mylong = new File (addit+"\\_long.dat");
                    if (mylong .exists()) {
                          mylong.delete();
                          //mylong.createNewFile();
                      } else {
                            //mylong.createNewFile();
                              myemigrant = new File (mydir.getParent()+"\\_emigrant.dat");
                              if (myemigrant.exists()) {
                                   myemigrant.delete();
                                  // myemigrant.canWrite();
                                } else {
                                     //  myemigrant.canWrite();
                   mytravel= new File (mydir.getParent().toString()+"\\_traveller.dat");
                    if (mytravel.exists()) {
                        mytravel.delete();
                       // mytravel.createNewFile();
                      } else {
                           //mytravel.createNewFile();
                    myinstitution = new File (mydir.getParent().toString()+"\\_institution.dat");
                    if (myinstitution.exists()) {
                          myinstitution.delete() ;
                         // myinstitution.createNewFile();
                      } else {
                           //myinstitution.createNewFile();
                    myvagrant = new File (mydir.getParent().toString()+"\\_vagrant.dat");
                    if (myvagrant .exists()) {
                         myvagrant.delete();
                        // myvagrant.createNewFile();
                      } else {
                           //myvagrant.createNewFile();
         //}//initial
              for( int index2 =0;index2<myList.size();index2++)//loop the second one for individual files
                   File file= (File)myList.get(index2);
                   if (file.getParent().contains("00"))//leave node
                        parentPath =file.getParent().substring(0, file.getParent().length()-4);
                   else
                        parentPath =file.getParent().substring(0, file.getParent().length()-3);
                   if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new  FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
    }//class Directories

    kingspalace wrote:
    Dr Clap
    The problem i am having is that whereas i am very sure that there are contents in the files i am trying to read , this part of the code Print the Values of parentPath,directory.getParent() and file.getName() here .In the start of this if condition to get a idea what stuff is coming here.
    if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                   {Are you trying to compare parentPath and directory.getParent() as Strings ? How about using equals() ?
    Also are you aware that a single & and && are not one and the same ?
    & will check nevertheless even if the string comparison on the parentPath returns true or false.
    && will not check file.getName() part if the String comparison part fails.
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
                             }How about adding a simple Exception catch block here ,in case you miss anything ?
    never gets executed executed (meaning ,according to the code, the files am reading have no content ). i am a bit new to files and directories in java . i am hence seeking advice on what i could be doing wrong .IN short,debugging your code will help you a lot.

Maybe you are looking for