Reading file and parseInt - PROBLEM

Hi, I am trying read from .txt file but I have a problem when I use Integer.parseInt. Can you see what could be wrong in this source:
public String loadPlayerFromTxt() {
String result = "";
try{
FileInputStream fstream = new FileInputStream("Test.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
int position = 0;
while ((br.readLine()) != null) {
Gamer gamer = new Gamer();
gamer.setName(br.readLine());
gamer.setRace(br.readLine());
gamer.setRole(br.readLine());
gamer.setLevel(Integer.parseInt(br.readLine()));
String [] array = new String [6];
String abilities = br.readLine();
String str = abilities.trim();
//System.out.println(abilities);
array = str.split(",");
gamer.setStrength(Integer.parseInt(array[0]));
gamer.setEndurance(Integer.parseInt(array[1]));
gamer.setDexterity(Integer.parseInt(array[2]));
gamer.setIntelligence(Integer.parseInt(array[3]));
gamer.setWisdom(Integer.parseInt(array[4]));
gamer.setCharisma(Integer.parseInt(array[5]));
this.gcollection.addGamer(gamer,position);
position++;
result = "succesful";
in.close();
catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
e.getLocalizedMessage();
return result;
Error message is:
Error: For input string: "12, 15, 19, 9, 14, 7"
java.lang.NumberFormatException: For input string: "12, 15, 19, 9, 14, 7"
     at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
     at java.lang.Integer.parseInt(Integer.java:456)
     at java.lang.Integer.parseInt(Integer.java:497)
     at ca5.GameControle.loadPlayerFromTxt(GameControle.java:56)
     at ca5.GameControle.main(GameControle.java:112)

Pavel.Prochy wrote:
Hi, I am trying read from .txt file but I have a problem when I use Integer.parseInt. Can you see what could be wrong in this source:
Error: For input string: "12, 15, 19, 9, 14, 7"
java.lang.NumberFormatException: For input string: "12, 15, 19, 9, 14, 7"The Integer.parseInt() method expects a String that contains only numbers. You are passing it the following string:
12, 15, 19, 9, 14, 7Which contains punctuation and whitespace (i.e. not just numbers). When the string you pass to Integer.parseInt() contains anything but numbers you get the "NumberFormatException" thrown. What you need to do is to do some pre-processing on the string you read from the file or (ideally) change the format of the file so that you have each of the numbers on their own line rather than having multiple numbers on the same line. If you HAVE to keep all the numbers on the same line then you will need to do the following (or something very similar to it):
public class Tester3 {
    public static void main(String[] args) {
       String input = "12, 15, 19, 9, 14, 7";
       String[] strings = input.split(",");
       for(String string : strings) {
            int parameter = Integer.parseInt(string.trim());
            System.out.println("parameter: "+parameter);
}Program output from above code:
parameter: 12
parameter: 15
parameter: 19
parameter: 9
parameter: 14
parameter: 7When you use the Integer.parseInt() call you should consider the possibility that your input will cause the call to fail. You can pre-process the input to ensure it will not fail, catch the NumberFormatException by wrapping the call to Integer.parseInt() in a try-catch block or create a method in your class that throws a NumberFormatException to its caller and let the caller handle the error
Edited by: amp88 on Nov 4, 2009 2:26 AM
Edited by: amp88 on Nov 4, 2009 2:27 AM

Similar Messages

  • I just stared having problems with importing files from nikon D810 into LR 5.7 it pop a window saying it can not read files on working on a imac 27" running yosemite on my mac pro after a few times it finally was able to read files and import them into LR

    I just stared having problems with importing files from nikon D810 into LR 5.7 it pop a window saying it can not read files on working on a imac 27" running yosemite on my mac pro after a few times it finally was able to read files and import them into LR I never had this problem before was there some kind of update that could of cause this?

  • Hi, since i put some mp4 video or DVD files on my external hard drives final cut prox won't recognize my hard drives, i move all the video files and the problem still exist. somebody have the solution

    Hi, since i put some mp4 video or DVD files on my external hard drives final cut prox won't recognize my hard drives, i move all the video files and the problem still exist. somebody have the solution

    Did the back and forth between PC and Mac file systems screw up my files somehow?
    Yes. Unfortunately the move has almost certainly caused the loss of the resource data that would have been (invisibly) attached to those files.
    By adding a specific .mov extension after the fact you will have helped the Mac correctly identify the file type / asscoiations but also significantly you will have physically changed the filename eg from "clip" to "clip.mov". This means that when you come to reconnect the media in FCP , then FCP will be looking for files that no longer exist at the given path eg when specifically looking for our example clip called "clip" of course it won't find it.
    Try this as a test... first remove the ".mov" extension from one or more of the clips, select those clips and press Cmd-Opt-I to open an Info window for the selection. You'll see an "Open with:" popup and in that popup you should choose QuickTime Player (if its a Unix Executable then it will initially list Terminal as the appropriate app, you have to choose Other... then in the open dialog choose Enable > All Applications and then navigate to and select the Quicktime Player app as the appropriate app). After you've done that restart FCP and see if you can now reconnect to those clips.

  • Reading files and converting into xml structure

    Hi,
    In my application a client requests for the folder structure information to a server through RMI. The server needs to read files and folders on local machine and convert it into some structure (I am thinking of using xml) and send it back. For eg: I am planning to have Server send back something like:
    <directory name = "parentdirectory">
    <file name = "abc.jpg"/>
    <file name = "def.bmp"/>
    <directory" name = "subdirectory">
    <file name = "hij.jpg"/>
    <file name = "klm.bmp"/>
    </directory>
    </directory>
    It is just the names of the files I am interested in and not the contents. Is this a good approach of sending back the data as a string containg xml definition. Is there any better appproach in terms of performance, memory etc? I am currently planning on using DOM for construction of this structure. Is there a source code for reading and converting the folder structure into xml. Just for your information, the clients gets this information and shows it as a tree structure on the GUI.
    Thanks!!!!

    Is this a good approach of sending back the data as a string containg xml definition. It'll work.
    An alternative, more direct approach is to build a memory representation and send this as argument/return value of an RMI call. You'd need to write classes MyDirectory and MyFile; MyFile has just a name; MyDirectory has a name and a collection of MyDirectory and one of MyFile. Make these classes implement Serializable and you can send them over RMI.
    The effort to write those trivial classes would be less than to implement XML encoding/decoding, and also in terms of runtime performance and memory it will be hard to beat Java's serialization with anything XML-based. In this case I doubt performance/memory are relevant considerations though.
    If for some reason I'd go for sending XML Strings anyway, I wouldn't do the encoding/decoding myself; I'd use XStream to convert Java classes to/from XML and still end up writing the above two classes and be done.
    Sorry if you wanted a simple yes or no :-)

  • File and FileInputStream problem

    Hi all
    I have downloaded from developpez.com a sample code to zip files. I modified it a bit to suit with my needs, and when I launched it, there was an exception. So I commented all the lines except for the first executable one; and when it succeeds then I uncomment the next executable line; and so on. When I arrived at the FileInputStream line , the exception raised. When I looked at the code, it seemed normal. So I want help how to solve it. Here is the code with the last executable line uncommented, and the exception stack :
    // Copyright (c) 2001
    package pack_zip;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import oracle.jdeveloper.layout.*;
    import java.io.*;
    import java.util.*;
    import java.util.zip.*;
    import java.text.*;
    * A Swing-based top level window class.
    * <P>
    * @author a
    public class fzip extends JFrame implements ActionListener{
    JPanel jPanel1 = new JPanel();
    XYLayout xYLayout1 = new XYLayout();
    JTextField szdir = new JTextField();
    JButton btn = new JButton();
    JButton bzip = new JButton();
         * Taille générique du tampon en lecture et écriture
    static final int BUFFER = 2048;
    * Constructs a new instance.
    public fzip() {
    super("Test zip");
    try {
    jbInit();
    catch (Exception e) {
    e.printStackTrace();
    * Initializes the state of this instance.
    private void jbInit() throws Exception {
    this.getContentPane().setLayout(xYLayout1);
         this.setSize(new Dimension(400, 300));
    btn.setText("btn");
    btn.setActionCommand("browse");
    btn.setLabel("Browse ...");
    btn.setFont(new Font("Dialog", 0, 14));
    bzip.setText("bzip");
    bzip.setActionCommand("zipper");
    bzip.setLabel("Zipper");
    bzip.setFont(new Font("Dialog", 0, 14));
    btn.addActionListener(this);
    bzip.addActionListener(this);
    bzip.setEnabled(false);
         this.getContentPane().add(jPanel1, new XYConstraints(0, 0, -1, -1));
    this.getContentPane().add(szdir, new XYConstraints(23, 28, 252, 35));
    this.getContentPane().add(btn, new XYConstraints(279, 28, 103, 38));
    this.getContentPane().add(bzip, new XYConstraints(128, 71, 103, 38));
    public void actionPerformed(ActionEvent e)
    if(e.getActionCommand() == "browse")
    FileDialog fd = new FileDialog(this);
    fd.setVisible(true);
    szdir.setText(fd.getDirectory());
    bzip.setEnabled(true);
    else
              * Compression
         try {
              // création d'un flux d'écriture sur fichier
         FileOutputStream dest = new FileOutputStream("Test_archive.zip");
              // calcul du checksum : Adler32 (plus rapide) ou CRC32
         CheckedOutputStream checksum = new CheckedOutputStream(dest, new Adler32());
              // création d'un buffer d'écriture
         BufferedOutputStream buff = new BufferedOutputStream(checksum);
              // création d'un flux d'écriture Zip
         ZipOutputStream out = new ZipOutputStream(buff);
         // spécification de la méthode de compression
         out.setMethod(ZipOutputStream.DEFLATED);
              // spécifier la qualité de la compression 0..9
         out.setLevel(Deflater.BEST_COMPRESSION);
         // buffer temporaire des données à écriture dans le flux de sortie
         byte data[] = new byte[BUFFER];
              // extraction de la liste des fichiers du répertoire courant
         File f = new File(szdir.getText());
         String files[] = f.list();
              // pour chacun des fichiers de la liste
         for (int i=0; i<files.length; i++) {
                   // en afficher le nom
              System.out.println("Adding: "+files);
    // création d'un flux de lecture
    FileInputStream fi = new FileInputStream(files[i]);
    /* // création d'un tampon de lecture sur ce flux
    BufferedInputStream buffi = new BufferedInputStream(fi, BUFFER);
    // création d'en entrée Zip pour ce fichier
    ZipEntry entry = new ZipEntry(files[i]);
    // ajout de cette entrée dans le flux d'écriture de l'archive Zip
    out.putNextEntry(entry);
    // écriture du fichier par paquet de BUFFER octets
    // dans le flux d'écriture
    int count;
    while((count = buffi.read(data, 0, BUFFER)) != -1) {
              out.write(data, 0, count);
                   // Close the current entry
    out.closeEntry();
    // fermeture du flux de lecture
              buffi.close();*/
    /*     // fermeture du flux d'écriture
         out.close();
         buff.close();
         checksum.close();
         dest.close();
         System.out.println("checksum: " + checksum.getChecksum().getValue());*/
         // traitement de toute exception
    catch(Exception ex) {
              ex.printStackTrace();
    And here is the error stack :
    "D:\jdev32\java1.2\jre\bin\javaw.exe" -mx50m -classpath "D:\jdev32\myclasses;D:\jdev32\lib\jdev-rt.zip;D:\jdev32\jdbc\lib\oracle8.1.7\classes12.zip;D:\jdev32\lib\connectionmanager.zip;D:\jdev32\lib\jbcl2.0.zip;D:\jdev32\lib\jgl3.1.0.jar;D:\jdev32\java1.2\jre\lib\rt.jar" pack_zip.czip
    Adding: accueil188.cfm
    java.io.FileNotFoundException: accueil188.cfm (Le fichier spécifié est introuvable.
         void java.io.FileInputStream.open(java.lang.String)
         void java.io.FileInputStream.<init>(java.lang.String)
         void pack_zip.fzip.actionPerformed(java.awt.event.ActionEvent)
         void javax.swing.AbstractButton.fireActionPerformed(java.awt.event.ActionEvent)
         void javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(java.awt.event.ActionEvent)
         void javax.swing.DefaultButtonModel.fireActionPerformed(java.awt.event.ActionEvent)
         void javax.swing.DefaultButtonModel.setPressed(boolean)
         void javax.swing.plaf.basic.BasicButtonListener.mouseReleased(java.awt.event.MouseEvent)
         void java.awt.Component.processMouseEvent(java.awt.event.MouseEvent)
         void java.awt.Component.processEvent(java.awt.AWTEvent)
         void java.awt.Container.processEvent(java.awt.AWTEvent)
         void java.awt.Component.dispatchEventImpl(java.awt.AWTEvent)
         void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
         void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
         void java.awt.LightweightDispatcher.retargetMouseEvent(java.awt.Component, int, java.awt.event.MouseEvent)
         boolean java.awt.LightweightDispatcher.processMouseEvent(java.awt.event.MouseEvent)
         boolean java.awt.LightweightDispatcher.dispatchEvent(java.awt.AWTEvent)
         void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
         void java.awt.Window.dispatchEventImpl(java.awt.AWTEvent)
         void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
         void java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent)
         boolean java.awt.EventDispatchThread.pumpOneEvent()
         void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional)
         void java.awt.EventDispatchThread.run()
    Thank you very much

    One easy way to send a file through RMI is to read all bytes of a file to a byte array and send this array as a parameter of a remote method. But of course you may have problems with memory when you send large files. The receive is simillary.
    Other way is to split the file and getting slices of the file, sending slices and re-assemble at destination. This assume that the file isn't changed through the full transfering is concluded.
    I hope these could help you.

  • RFC to read file and continue

    Hello,
    I have the following scenario:
    I have a report that needs to work with data saved in a CSV file in another server connected with XI.
    In my report I have to call a function to read de CSV file, wait, and continue when XI gives me the response.
    Is possible that scenaro? How can I built that? My RFC function is just an empty tables parameter that waits to be filled by XI. Now the problem is the XI. How can I read the file synchronous and fill the RFC response?
    Edited by: Marshal Oliveras on Apr 29, 2008 11:48 AM

    Hi,
    no, this is not possible. At least, not w/o further development. You can't use FILE adapter for this (does not support sync processing). What would be possible - develop a web service, which will be called, reads the file and returns it back to the function. So the whole process would look like this:
    You call some function in R/3, this sends request to PI, PI transforms the request and sends it to Web service. Web Service reads the file and returns it back to PI & PI sends this to the calling function.
    Peter
    Edited by: Peter Jarunek on Apr 29, 2008 11:51 AM

  • Read file and post to MQ

    Hi,
    I have a senario:
    * Read text file from a directory.
    * Post the content to MQ.
    I dont have any schema for the content of the txt file.
    So I used the opaque type in my FileAdapter while reading the text file and posted the data to MQ by using the MQAdapter.
    But since content is opaque, data in the MQ is not understandable.
    So I want to understand , how I can send the text data to MQ so that it can be understood.

    Hi All,
    I found the solution for the error which I was mentioning.
    I had to import below classes to make it work.
    <bpelx:exec import="java.util.*"/>
    <bpelx:exec import="java.lang.*"/>
    <bpelx:exec import="java.math.*"/>
    <bpelx:exec import="java.io.*"/>
    <bpelx:exec import="oracle.soa.common.util.Base64Decoder"/>
    After importing it my compilation problem is solved.
    Now I have new problem :)
    I have written below code in Java Embedding for the purpose of decoding
    try
    String messagePayload =(String)getVariableData("inputMessage");
    // decode the message
    byte[] decodedBytes = Base64Decoder.decode(messagePayload.getBytes());
    String decoded = new String(decodedBytes);
    setVariableData("tempBase64EncodedData",decoded);
    catch(Exception e)
    addAuditTrailEntry(e.toString());
    But after this if, I am trying to copy message from "tempBase64EncodedData" to any other variable, it is coming as Empty.
    So, my question is
    * Am I doing correct thing to assign the decoded message into variable called "tempBase64EncodedData" ?
    or
    * Decoding iteslef is having some issues ?

  • Synchronous read file and status update

    Hi,
    CSV file to be loaded into the database table. ASP used as front end and ESB should be used for backend processing!
    A csv file is placed in a fileshare by an asp page. After that a button is clicked on the asp page which inserts a record into a database table(A) with the file details. There is a flag field in the table which will be set to 'F' initially.
    Now there should be an esb service which will be polling for any new records inserted into the database table(A).
    Once it finds any new record, the esb service should update the flag status to 'RF' from 'F' and read the records in the csv file(I think synchronous read file should be used inthe file adapter) and insert them into a database table(B). The flag field is updated to 'RF' so that the asp page informs the user that the csv file is being inserted into the table(B).
    After all the records are inserted, the esb service should once again update the flag in table(A) to 'Y' from 'RF' so that the asp page will indicate the user that the csv file is loaded into the data base table.
    The challenges that I have here are:
    1) I need to have the ESB service with such a sequence of execution that updates the table(A) at each stage so that the asp page can display the status to the USER.
    2) The csv file size can be huge. It can contain as many as 100 thousand records with over 50 fields in each record. I will have to probably debatch the file. Once we debatch, seperate instance would be created for each batch. Now we should see to that flag in table(A) is updated to 'Y' only when the last batch of the records are processed.
    I am using jdev10134 and oracle SOA suite ESB10134
    Someone please advice on how to go ahead.
    Cheers,
    RV

    Hi,
    CSV file to be loaded into the database table. ASP used as front end and ESB should be used for backend processing!
    A csv file is placed in a fileshare by an asp page. After that a button is clicked on the asp page which inserts a record into a database table(A) with the file details. There is a flag field in the table which will be set to 'F' initially.
    Now there should be an esb service which will be polling for any new records inserted into the database table(A).
    Once it finds any new record, the esb service should update the flag status to 'RF' from 'F' and read the records in the csv file(I think synchronous read file should be used inthe file adapter) and insert them into a database table(B). The flag field is updated to 'RF' so that the asp page informs the user that the csv file is being inserted into the table(B).
    After all the records are inserted, the esb service should once again update the flag in table(A) to 'Y' from 'RF' so that the asp page will indicate the user that the csv file is loaded into the data base table.
    The challenges that I have here are:
    1) I need to have the ESB service with such a sequence of execution that updates the table(A) at each stage so that the asp page can display the status to the USER.
    2) The csv file size can be huge. It can contain as many as 100 thousand records with over 50 fields in each record. I will have to probably debatch the file. Once we debatch, seperate instance would be created for each batch. Now we should see to that flag in table(A) is updated to 'Y' only when the last batch of the records are processed.
    I am using jdev10134 and oracle SOA suite ESB10134
    Someone please advice on how to go ahead.
    Cheers,
    RV

  • How to read file and output base64 string?

    im having a hard time reading binary file and converting it to base64.
    is there a parameter in extendscript like file.read('base64') ??

    It is possible in HTML:
    var path = "/tmp/test"; 
    result = window.cep.fs.readFile(path, cep.encoding.Base64);
    if (0 == result.err) {
         //success
         var base64Data = result.data;
         var data = cep.encoding.convertion.b64_to_utf8(base64Data);
    else {
         ...// fail
    You can also refer to the following samples for more examples:
    https://github.com/Adobe-CEP/Samples/tree/master/Flickr
    https://github.com/Adobe-CEP/Samples/tree/master/Collage

  • Read file and store the file into a string

    i want to read the file and copy it to a string.
    i wrote this code but don't know what to do next..
    please help me urgent.....
    File file_to_text = new File("c:\\wtgapp.xml");
    String wtgapp_string=new String();
    try
    BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file_to_text));
    catch (FileNotFoundException file_error)
    JOptionPane.showMessageDialog(null, "FILE READ ERROR", "READ ERROR!",JOptionPane.INFORMATION_MESSAGE );
    System.exit(1);
    }

    BufferedReader reader = new BufferedReader(new FileReader(file_to_text));
    try
    while(reader.readLine() !=)
    wtgapp_string = wtgapp_string+ reader.readLine();
    System.out.println(wtgapp_string);
    i did this..
    but reader.readLine() != null
    didn't work.
    what shoud i write? to go to the end of file
    no it is 16.00pm in here i live in TURKIYE istanbul :)

  • Reading file and dump data into database using BPEL process

    I have to read CSV files and insert data into database.. To achieve this, I have created asynchronous bpel process. Added Filed Adapter and associated it with Receive activity.. Added DB adapter and associated with Invoke activity. Total two receive activity are available in  process, when tried to Test through EM, only first receive activity is completed, and waiting on second receive activity. Please suggest how to proceed with..
    Thanks, Manoj.

    Deepak, thank for your reply.. As per your suggestion I created BPEL composite with
    template "Define Service Later". I followed below steps, please correct me if I am wrong/missing anything. Your help is highly appreciated...
    Step 1-
    Created File adapter and corresponding Receive Activity (checkbox create instance is checked) with input variable.
    Step 2 - Then in composite.xml, dragged the
    web service under "Exposed Services" and linked the web service with Bpel process.
    Step 3 - Opened .bpel file and added the DB adapter with corresponding Invoke activity, created input variable. Web service is created of Type "Service" with existing WSDL(first option aginst WSDL URL).
    and added Assign activity between receive and invoke activities.
    Deployed the composite to server, when triedTest it
    manually through EM, it is promting for input like "subElmArray Size", then I entered value as 1 with corresponding values for two elements and click on Test We Service button.. Ptocess is completing in error. The error is
    Error Message:
    Fault ID
    service:80020
    Fault Time
    Sep 20, 2013 11:09:49 AM
    Non Recoverable System Fault :
    Correlation definition not registered. The correlation set definition for operation Read, process default/FileUpload18!1.0*soa_3feb622a-f47e-4a53-8051-855f0bf93715/FileUpload18, is not registered with the server. The correlation set was not defined in the process. Redeploy the process to the containe

  • I downloaded a reader file and it screwed up my Safari browser and the app opens with the Goggle Quick search which I can't get rid of

    I downloaded a file to open a owners manual for a camera I needed. I had difficulty getting it down loaded and never could get the manual. I tried using my Safari browser and started getting this Goggle Quick Search file which opened in place of my Safari….I tried to close it and I can't. I did manage to get ride of the reader file.

    You may have installed one of the common types of ad-injection malware. Follow the instructions on this Apple Support page to remove it. It's been reported that some variants of the "VSearch" malware block access to the page. If that happens, start in safe mode by holding down the shift key at the startup chime, then try again.
    Back up all data before making any changes.
    One of the steps in the article is to remove malicious Safari extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those. If Safari crashes on launch, skip that step and come back to it after you've done everything else.
    If you don't find any of the files or extensions listed, or if removing them doesn't stop the ad injection, ask for further instructions.
    Make sure you don't repeat the mistake that led you to install the malware. It may have come from an Internet cesspit such as "Softonic" or "CNET Download." Never visit either of those sites again. You might also have downloaded it from an ad in a page on some other site. The ad would probably have included a large green button labeled "Download" or "Download Now" in white letters. The button is designed to confuse people who intend to download something else on the same page. If you ever download a file that isn't obviously what you expected, delete it immediately.
    Malware is also found on websites that traffic in pirated content such as video. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow. Never install any software that you downloaded from a bittorrent, or that was downloaded by someone else from an unknown source.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates
    if it's not already checked.

  • HRRCF_MDL_CAND_ATT_CREATE - Read file and covert to 'content'

    Hi,
    We are trying to use FM u2018HRRCF_MDL_CAND_ATT_CREATEu2019 to upload attachment for Candidate (Candidate already in E-Recruiting system). This FM has import parameter u2018CONTENTu2019 (Data Type u2018RAWSTRINGu2019).
    I want to know how to read file (File type can be any) from drive and covert into u2018Contentsu2019. Is there any FM to do this?
    Regards,
    ...Naddy

    I'm getting type cpmpatiable error.
    This is my code,
    REPORT  zhr_test_ngo_attachment.
    PARAMETERS: p_cand  TYPE  hrobject DEFAULT '01NA50000305'
              , p_head TYPE rcf_attachment_header
              , p_fname         TYPE  string.
    DATA:   v_record        TYPE  rcf_s_mdl_cand_attachment,
            v_content       TYPE  rcf_attachment_content,
            v_messages      TYPE  bapirettab,
            v_records       TYPE  rcf_t_mdl_cand_attachment,
            v_size          TYPE  i,
            v_string        TYPE  xstring.
    DATA: BEGIN OF xml_tab OCCURS 0,
              raw TYPE x,
           END   OF xml_tab .
    v_record-att_type = '0012'.
    v_record-language = 'E'.
    v_record-att_header = p_head.
    *Get file
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename            = p_fname
        filetype            = 'BIN'
        has_field_separator = ' '
        header_length       = 0
      IMPORTING
        filelength          = v_size
      TABLES
        data_tab            = xml_tab
      EXCEPTIONS
        OTHERS              = 1.
    v_content = xml_tab[].
    CALL FUNCTION 'HRRCF_MDL_CAND_ATT_CREATE'
      EXPORTING
        record        = v_record
        cand_hrobject = p_cand
        content       = v_content
        filename      = p_fname
      IMPORTING
        messages      = v_messages.
    IF sy-subrc <> 0.
      WRITE 'Attachment Error'.
    ENDIF.

  • Read files and folders from a CD

    Hi there,
    I am not sure this is the right forum for my question. Please redirect me if I am in the wrong place.
    I have an AIR app that will be installed from a CD. The client will be changing certain data (like images and video files) regularly and wants to be able to simply write a cd with the new files in a folder and the AIR app install.
    I have searched high ad low for ways to read files from a CD. I could do this if I knew the path, but on each system it is different.
    Is there anything which can tell me what the path to the CD drive is or a way to package AIR so that when it installs it looks for a directory on the CD it is installing from and copies it to the AIR application directory?
    Any help is welcome!
    Thanks in advance,
    Nikki

    Hi - it looks like you can find the CD drive using the getStorageVolumes() method of StorageVolumeInfo:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/Storag eVolumeInfo.html#getStorageVolumes%28%29
    So you'd  iterate through all the storage volumes, and for the ones that are removable (isRemovable property), check for the existence of some file you know will be on your CD (a unique name), and you would then know that is your install CD.
    -rich

  • Jar file and classpath problem

    I0m writing a program that use the kunststoff.jar Look&Feel.
    Now I would like to put all I'm writing into a jar file but I always have a NoClassFoundException when I try to start my application.
    here is a MANIFEST:ME I'm using:
    Manifest-Version: 1.0
    Created-By: 1.4.2-beta (Sun Microsystems Inc.)
    Main-Class: JListaR.JListaR
    Class-Path: kunststoff.jar img\ .why this don't work?

    Unfortunately you can't embed jars within a jar and
    expect them to be referencable for the classpath from
    outside the main jar. The "Class-Path" attribute in
    the manifest is used to refer to other jar files
    outside of your jar file.
    The usual approach to solve this problem is to unpack
    the jar files you want to embed and then rejar
    everything together in one big jar file again. This
    isn't always a great approach though, I know I'm
    looking for an alternative. So far my only alternative
    is dynamic class loading using a classloader, however
    this isn't great if you need to refer to several
    hundreds or even thousands of classes.thank you very mach...now I understand because it dosen't work correctly!

Maybe you are looking for

  • How to create a bootabale clone?

    My Mac Book Air [MBA] has 128GB solid-state drive. I have bought an Iomega External Portable Hard Drive Mac edition for the back up through Time Mechine and to create a bootable clone. Can some one help me or direct me to a manual that will help me o

  • Run a workflow with a low security role profile

    Hello, I created a workflow that is sending an email to the administrator when a certain action has to be done. To make sure this workflow has actually been running, I ended it with a step that update a two option field as 'Email sent'.  I would like

  • Getting WebEngine CANCELLED state when loading a url

    Hi, I am using WebView / WebEngine to display an internal website developed using GWT. I have registered a change listener on the load worker. When I load any website (internally developed or external from the internet) I am getting the normal change

  • Badis for CMXSV

    Hi experts,       I have a task to implment badis for the transaction <b>CMXSV</b> . I was able to locate the Badi but could not go any further form there. I could not find any documentation in SDN or any other site. Plz help me in this regards. Than

  • Yahoo on Mail

    I'm using Yahoo on Mail and it worked fine, it was a pop account, then mail could simply not get the mails from the server anymore. So I deleted the account and wanted to set it up again. I am not able to choose, it automatically sets up an imap acco