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
Similar Messages
-
Copying files - how to skip bad files and continuing to copy?
I recovered some files off a dieing HDD (approximately 600GB worth). These are sitting on a good condition and fully functioning external HDD. I am trying to copy these files from this external HDD to another external HDD. It appears that some of the files that were recovered are actually corrupt as when copying and pasting, it gets to around the 120GB mark before I received the following error:
"The Finder can't complete the operation becauise some data in [files name] can't be read or written.
(Error code -36)"
When attemping the Ditto command in terminal, at the same point, I get the following error in Terminal:
"Volume/[drive name]/[folder name]/[file name]: Input/output error"
Due to the number of files (in the 100's of thousands I believe) I do not want to start trying to copy and paste individual files and folders.
Does anyone know of a program that will skip the bad files and continue to copy? Microsoft Windows does this natively, but as my HDD are in Mac OS X format, that doesn't help. Surely there is some App or program that can perform this function?I recovered some files off a dieing HDD (approximately 600GB worth). These are sitting on a good condition and fully functioning external HDD. I am trying to copy these files from this external HDD to another external HDD. It appears that some of the files that were recovered are actually corrupt as when copying and pasting, it gets to around the 120GB mark before I received the following error:
"The Finder can't complete the operation becauise some data in [files name] can't be read or written.
(Error code -36)"
When attemping the Ditto command in terminal, at the same point, I get the following error in Terminal:
"Volume/[drive name]/[folder name]/[file name]: Input/output error"
Due to the number of files (in the 100's of thousands I believe) I do not want to start trying to copy and paste individual files and folders.
Does anyone know of a program that will skip the bad files and continue to copy? Microsoft Windows does this natively, but as my HDD are in Mac OS X format, that doesn't help. Surely there is some App or program that can perform this function? -
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 :-) -
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?
-
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,
RVHi,
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 -
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 ? -
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,
...NaddyI'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,
NikkiHi - 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 -
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 -
HOW TO READ FILE AND HOW TO USE IT IN PATTERN EX. READ_TEXT
I WANT TO USE A PROGRAM'S CONTENT ND I WANT TO PASS AS PARAMETER IN A PATTERN..HOW TO DO THT.PLZZ REPLY...
EX. I HAV CREATED A STANDARD TEXT ZCREATE_TEXT AND I WANT TO SEND THIS AS A PARAMETER TO READ_TEXT...HOW TO DO THIS..Hi,
When you create a Std Text in SO10 and save, it is saved with 4 parameters
like TEXT NAME, LANGUAGE, TEXT OBJECT, TEXT ID. these are the four parameters by default will be created for any std text when you create a TEXT in SO10 or in any document.
You will know this 4 parameters from SO10 screen.
enter text, display.
from Menu -> GOTO -> HEADER, see them.
Next when you wants to fetch this text using READ_TEXT fun module
yopu have to pass this 4 parameters to that fun module.
see the doc
READ_TEXT
READ_TEXT provides a text for the application program in the specified work areas.
The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.
After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.
If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.
Function call:
CALL FUNCTION 'READ_TEXT'
EXPORTING CLIENT = SY-MANDT
OBJECT = ?...
NAME = ?...
ID = ?...
LANGUAGE = ?...
ARCHIVE_HANDLE = 0
IMPORTING HEADER =
TABLES LINES = ?...
EXCEPTIONS ID =
LANGUAGE =
NAME =
NOT_FOUND =
OBJECT =
REFERENCE_CHECK =
WRONG_ACCESS_TO_ARCHIVE =
Export parameters:
CLIENT
Specify the client under which the text is stored. If you omit this parameter, the system uses the current client as default.
Reference field: SY-MANDT
Default value: SY-MANDT
OBJECT
Enter the name of the text object to which the text is allocated. Table TTXOB contains the valid objects.
Reference field: THEAD-TDOBJECT
NAME
Enter the name of the text module. The name may be up to 70 characters long. Its internal structure depends on the text object used.
Reference field: THEAD-TDNAME
ID
Enter the text ID of the text module. Table TTXID contains the valid text IDs, depending on the text object.
Reference field: THEAD-TDID
LANGUAGE
Enter the language key of the text module. The system accepts only languages that are defined in table T002.
Reference field: THEAD-TDSPRAS
ARCHIVE_HANDLE
If you want to read the text from the archive, you must enter a handle here. The system uses it to access the archive. You can create the handle using the function module ACHIVE_OPEN_FOR_READ.
The value '0' indicates that you do not want to read the text from the archive.
Reference field: SY-TABIX
Default value: 0
Import parameters:
HEADER
If the system finds the desired text, it returns the text header in this parameter.
Structure: THEAD
Table parameters:
LINES
The table contains all text lines that belong to the text read.
Structure: TLINE
Exceptions:
ID
The text ID specified in the parameter ID does not exist in table TTXID. It must be defined there together with the object of the text module.
LANGUAGE
The parameter LANGUAGE contains a language key that does not exist in table T002.
NAME
The parameter NAME contains the name of a text module that does not correspond to the SAPscript conventions.
Possible errors:
The field contains only blanks.
The field contains the invalid characters * or ,.
OBJECT
The parameter OBJECT contains the name of a text object that does not exist in table TTXOB.
NOT_FOUND
The system did not find the specified text module.
REFERENCE_CHECK
The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists.
WRONG_ACCESS_ TO_ARCHIVE
The exception WRONG_ACCESS_TO_ARCHIVE is triggered if an archive is accessed using an incorrect or non-existing archive handle or an incorrect mode (that is, read if the archive is open for writing or vice versa).
reward points
regards,
ANJI -
Reading files and directory from a directory
ublic static void readFromDirectory(String dirName) {
// stop word ArrayLists
ArabicStop();
EnglishStop();
FrenchStop();
SpanishStop();
DutchStop();
File dir = new File(dirName);
if (dir.isDirectory()) {
String[] child = dir.list();
System.out.println("hi Iam here");
for (int i = 0; i < child.length; i++) {
readFromDirectory(child.toString());
File[] files = dir.listFiles();
if (files == null) {
System.out.println("There are no files in this Directory ");
} else {
for (int j = 0; j < files.length; j++) {
String filename = files[j].toString();
readFile(filename);
if (dirName.equalsIgnoreCase("English")
|| dirName.equalsIgnoreCase("Nonenglish")) {
for (int i = 0; i < a2.size(); i++) {
keyWord = a2.get(i).toString();
//System.out.println("===" + keyWord + "===" + "KeyWord");
for (int a = 0; a < text.size(); a++) {
String t1 = text.get(a).toString();
if (keyWord.equalsIgnoreCase(t1)) {
count++;
//System.out.println("Found at:" + files[j] + " file");
keyWCount = count;
m1.put(keyWord, keyWCount);
//System.out.println(m1.get(keyWord));
count = 0;
} else if (dirName.equalsIgnoreCase("Spanish")) {
for (int i = 0; i < a5.size(); i++) {
keyWord = a5.get(i).toString();
//System.out.println("===" + keyWord + "===" + "KeyWord");
for (int a = 0; a < text.size(); a++) {
String t1 = text.get(a).toString();
if (keyWord.equalsIgnoreCase(t1)) {
count++;
//System.out.println("Found at:" + files[j] + " file");
keyWCount = count;
m1.put(keyWord, keyWCount);
//System.out.println(m1.get(keyWord));
count = 0;
//System.out.println(m1);
} else if (dirName.equalsIgnoreCase("French")) {
for (int i = 0; i < a3.size(); i++) {
keyWord = a3.get(i).toString();
//System.out.println("===" + keyWord + "===" + "KeyWord");
for (int a = 0; a < text.size(); a++) {
String t1 = text.get(a).toString();
if (keyWord.equalsIgnoreCase(t1)) {
count++;
//System.out.println("Found at:" + files[j] + " file");
keyWCount = count;
m1.put(keyWord, keyWCount);
//System.out.println(m1.get(keyWord));
count = 0;
public static void main(String[] args) {
int countText = 0;
int c;
test t1 = new test();
System.out.println("IN NON - ENGLISH DOCUMENTS - P :");
t1.readFromDirectory("NonEnglish");
for (int j = 0; j < text.size(); j++) {
if (!text.get(j).toString().equalsIgnoreCase("")) {
countText++;
c = countText;
//System.out.println(c);
//System.out.println(text.size());
for (int i = 0; i < a2.size(); i++) {
String word = a2.get(i).toString();
String m = (m1.get(word)).toString();
double x = Double.parseDouble(m);
System.out.println(word + ":" + (x / c) * 100 + " %");
I wanna read text files from directory that contain - lots of other directorys... and by using this code I have error,,,
Can anyone help me plzzz
Edited by: Shamma on Oct 9, 2008 3:32 AMYou actually have more than 1 problem: you cannot traverse directories recursively and you get a NullPointerException.
For the first problem you might want to verify what this statement returns:
child.toString() (I honestly don't understand why you are calling toString() on a String object, but that's not the real problem!)
You probably expect it to be a full absolute path.
The NullPointerException has already been pointed out by masijade.
Maybe you are looking for
-
IPhoto 11: Thumbnails show as normal, but photos are blank
Hello everyone. I have a problem that I bet is common, but I'm not seeing it here in the discussions, maybe from people describing it as different things. I just opened iPhoto 11 to access some photos, went through the thumbnails, found the ones
-
Record Count Issue in Search page ?
Hi Friends I am trying to display record count on Search page and I have the following code in The table has total of 62 Rows AM : for testing purpose, i am printing in log public void getISAGRecordCount() OAViewObject vo = (OAViewObject)getXXG2_ELIM
-
How can I make a button that on press the object appears and on second press the object to disappear
Hello, I'm quite new to flash programing, and I don't know how can I make a button that will make the object appear and disappear.Till now I have this code for the appear: on (press) _root.top1.gotoAndStop(2); _root.topp.gotoAndStop(2); _
-
Can I use Ipod mini charger for Ipod Video?
Is it safe to use the USB charger supplied with IPOD Mini to charge my new 30GB Ipod video ?
-
I just purchased a refurb X1 Carbon. I plugged it in and it worked just fine. Then i pulled the power plug out and whoosh - it went dead right away. I tried turning it ON but it just won't. Plugged the power back in and it turn back on just fine. Th