Reading html files with File class
The methods of the class File does not identify html files. for example the method list() does not return names of html files in a givven directory? does anyone know what is the way to get the html files names and use them for file proccesing?
Thanks
The Temporary Internet Files folder is a special system folder on Windows. It does not really contain any of the files you can see when you go there through Internet Explorer or Windows Explorer.
On Win2K, using IE6.0, the real files seem to be in a directory called C:\Documents and Settings\<hhor>\Local Settings\Temporary Internet Files\Content.IE5\<some apparently random name>, where <hhor> is the name of my profile, and <some apparently random name> is, well... some apparently random name :)
Similar Messages
-
Update jar file with modified class files
hi all,
I'm developing a jar utility for updating a jar file with modified class files as of now i have reached a point where in i can browse files and set it to required location
i.e i have developed a swings GUI application using JfileChooser and browse the files ..now my requirement is to update the jar files with modified class file
GUI looks like below
....enter the modified class file ----> d:\c.class
....enter the jar file path ---> d:\a.jar
update button now i have the requirement as
1> when i click on the update button ,my jar file (a.jar) should get updated with the latest class file (c.class)
can u help me to achieve this requirement.???
im stuck with this,,,if u can provide me wit the code for updating jar file with latest class file...it will really be helpful
if u can help me with the code on click on update button it will be really helpful
Thanks and expecting a faster response from u all java experts....Please find my query in bolds...i have written the partial code now,i need some help now
hope u guys can help me out...
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
public class FileExplorer extends JDialog implements ActionListener
JTextField txtLocation_class;
JButton btnBrowse_class;
JLabel label_class;
JTextField txtLocation_jar;
JButton btnBrowse_jar;
JLabel label_jar;
JButton updatebutton;
public FileExplorer()
setSize(600,300);
//for class files
label_class = new JLabel("Please select Modified Class File");
txtLocation_class= new JTextField(20);
btnBrowse_class = new JButton("Browse");
btnBrowse_class.addActionListener(this);
//for jar files
label_jar = new JLabel(" Please select the Jar file");
txtLocation_jar= new JTextField(20);
btnBrowse_jar = new JButton("Browse");
btnBrowse_jar.addActionListener(this);
ActionListener updateListener = new ActionListener(){
public void actionPerformed(ActionEvent ae){
if(ae.getActionCommand().equalsIgnoreCase("Update")){
System.out.println("ae.getActionCommand() :: "+ae.getActionCommand());
System.out.println("Update Button is pressed");
*//Query :how do i access FilePath and FilePath1 here which*
* // has been set in public void actionPerformed(ActionEvent ae)*
* //method below*
* // FilePath ---??*
* // FilePath1 ---??*
* // how do i access the above 2 parameters*
* //Query :on click of update button i have to pass*
* //two parameters FilePath and FilePath1 to*
* //perform some functionality. please help me*
* //to achieve this..how do i access Filepath and Filepath1*
* //here which has been set below.*
} // end of if
} // end of actionPerformed
};// end of ActionListener
updatebutton = new JButton("Update");
updatebutton.addActionListener(updateListener);
//adding to the panel
JPanel pnl = new JPanel();
pnl.add(label_class);
pnl.add(txtLocation_class);
pnl.add(btnBrowse_class);
pnl.add(label_jar);
pnl.add(txtLocation_jar);
pnl.add(btnBrowse_jar);
pnl.add(updatebutton);
getContentPane().add(pnl);
public void actionPerformed(ActionEvent ae)
Object obj=ae.getSource();
if(obj==btnBrowse_class)
final JFileChooser fcstudent = new JFileChooser();
int rtrnval = fcstudent.showOpenDialog(this);
if(rtrnval==JFileChooser.APPROVE_OPTION)
try
File file=fcstudent.getSelectedFile();
String path = file.getPath();
System.out.println("This is Path:"+path);
txtLocation_class.setText(""+path);
String FilePath=txtLocation_class.getText();
System.out.println("FilePath is ::"+FilePath);
catch(Exception ex)
ex.printStackTrace();
}else if(obj==btnBrowse_jar){
final JFileChooser fcstudent = new JFileChooser();
int rtrnval = fcstudent.showOpenDialog(this);
if(rtrnval==JFileChooser.APPROVE_OPTION)
try
File file=fcstudent.getSelectedFile();
String path1 = file.getPath();
System.out.println("This is Path:"+path1);
txtLocation_jar.setText(""+path1);
String FilePath1=txtLocation_jar.getText();
System.out.println("FilePath is ::"+FilePath1);
catch(Exception ex)
ex.printStackTrace();
public static void main(String arg[]){
FileExplorer Exm= new FileExplorer();
Exm.setVisible(true);
} -
Hi
I can't open sql files with file type .pck. They are opened as a package. The icon is a package too. (Worked fine in 4.0)
My settings:
Thanks for any helpThanks, but that doesn't help
To specify it more precisly: I can open such a file, but it is not opened as a sql file. The icons you see above left are the icons of the files (not of the packages).
Greetings
Ovi -
How to read a xml file with StringReader class
Hi,
I need to read a XML document with StringReade class. My aplication receives an absolute path but this doesn't work:
StringReader oStringReader =
new StringReader(c:\java\libros.xml);
However it works with:
StringReader oStringReader =
new StringReader("<?xml version="1.0" e......");
ie, with the whole document as a String, but I need to do it as the frist way.
ThanksHi,
I need to read a XML document with StringReade class.
My aplication receives an absolute path but this
doesn't work:
StringReader oStringReader =
new StringReader(c:\java\libros.xml);
However it works with:
StringReader oStringReader =
new StringReader("<?xml version="1.0" e......");
ie, with the whole document as a String, but I need
to do it as the frist way.
Thankstake a look at this link:
http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/2a_echo.html -
Reading fixed position files with File Adapter
Hi !
I'm trying to use the file adapter to read a file with data in fixed positions .
I cannot get it to work, I'm getting :
[Line=3, Col=133] Expected "${eol}" at the specified position in the native data, while trying to read the data for "element with name Hours", using "style" as "array" and "cellSeparatedBy" as "${eol}", but not found.
Ensure that "${eol}", exists at the specified position in the native data.
and don't understand what the problem is.Sorry I didn't reply sooner.
If you are only interested in the first 133 characters then as you stated you need to put in a dummy filler at the end.
The file adapter is not as smart as you think. What is does is reads the string in a stream, so it gets its command and reads the stream until it hits it, then it gets the next command.
In your situation you said read 1 - 133 thinking it would ignore the other characters in the line. In reality what happens is that it reads the first 133 characters. Assuming that it wasn't looking for a end of line it would then read the next 133 characters. This would include the character you want to ignore, so your pattern would fail.
Good way to think about it is to apply the rules as if you are reading the file your self. In your mind you say read these characters then I want to ignore all the others in the row. You have to tell the file adapter to do the same.
Hope this explains.
cheers
James -
Importing text file (with file names) into Automator.. is it possible?
Hello all,
I have been working with Windows Batch files for my line of work. I have a couple of file names in a text file (a column), which I want to copy from one folder of one hdd to another folder on a different hdd. I have been trying to do this kind of work with a Mac. I already know how you copy and rename files in automator (which isn't difficult, of course) but you have to 'select' the files in the finder first (with get specified items).
But the only way i see that you can specify items is by selecting them... is there a way to import a text file with all the file names instead of selecting all the file names manually?
or is there an AppleScript alternative which I can use to import the text file (or just copy into applescript) and run before the query's of copying and renaming the files? I am kind of new to Apple programming.
The text file looks like this:
image1.jpg
image2.jpg
etc..
so there has to be a command to: 'goto' a specific folder as well.
Thanks in advance!You can import text files, but if they are just names you will need an additional action to add the source folder path. A *Run AppleScript* action can be used, for example:
Tested workflow:
1) *Ask for Finder Items* {Type: files } -- choose the text file containing the names
2) *Combine Text Files* -- this gets the text file contents
3) *Filter Paragraphs* { return paragraphs that are not empty } -- skip blank lines
4) *Run AppleScript* -- copy and paste the following script:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 680; height: 340px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into an Automator 'Run AppleScript' action">
on run {input, parameters} -- add folder path
add the specified folder path to a list of file names
input: a list of text items (the file names)
output: a list of file paths (aliases)
set output to {}
set SkippedItems to {} -- this will be a list of skipped items (errors)
set SourceFolder to (choose folder with prompt "Choose the folder containing the file names") as text -- this is the folder containing the names
repeat with AnItem in the input -- step through each name in the input
try
set AnItem to SourceFolder & AnItem -- add the prefix
set the end of the output to (AnItem as alias) -- test
on error number ErrorNumber -- oops
set ErrorNumber to (" (" & ErrorNumber as text) & ")" -- add the specific error number
set the end of SkippedItems to (AnItem as text) & ErrorNumber
end try
end repeat
ShowSkippedAlert for SkippedItems
return the output -- pass the result(s) to the next action
end run
to ShowSkippedAlert for SkippedItems
show an alert dialog for any items skipped, with the option to cancel the workflow
parameters - SkippedItems [list]: the items skipped
returns nothing
if SkippedItems is not {} then
set {AlertText, TheCount} to {"Error with AppleScript action", count SkippedItems}
if TheCount is greater than 1 then
set theMessage to (TheCount as text) & space & " items were skipped:"
else
set theMessage to "1 " & " item was skipped:"
end if
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set {SkippedItems, AppleScript's text item delimiters} to {SkippedItems as text, TempTID}
if button returned of (display alert AlertText message (theMessage & return & SkippedItems) ¬
alternate button "Cancel" default button "OK") is "Cancel" then error number -128
end if
return
end ShowSkippedAlert
</pre>
5) *Copy Finder Items* { To: _your external drive_ } -
Pick up a specific file with File Sender Adapter.
Hi guys,
I would like to know how I can pick a specific file in a file pool (folder)? I would like to choose this file by name, like FileA or FileB, etc.
Im asking this because I have an asynchronous file scenario (BPM) with a receiver adapter that put the File with a specific name (variable substitution) in a folder.
And I would like to do something like this:
In another asynchronous scenario (BPM), a File sender adapter picks up this specific file (using the name). The correlation is made trough an IDOC that XI receives before pick up the file, this IDOC has payload field with the name of file to be picked.
Is it possible receives the IDOC, read the field with the name of the file to be picked and choose this specific file? In a Sender File Adapter how I can do something like variable substitution like receiver adapter does.
Thanks in advance,
Ricardo.Hi,
<i>Is it possible receives the IDOC, read the field with the name of the file to be picked and choose this specific file? In a Sender File Adapter how I can do something like variable substitution like receiver adapter does.</i>
No this is not possible. The only dynamic thing you can do is use wild card characters like *.
So, maybe you can pick a file like . or AA. and so on...
Regards,
Bhavesh -
How to process large input CSV file with File adapter
Hi,
could someone recommend me the right BPEL way to process the large input CSV file (4MB or more with at least 5000 rows) with File Adapter?
My idea is to receive data from file (poll the UX directory for new input file), transform it and then export to one output CSV file (input for other system).
I developed my process that consists of:
- File adapter partnerlink for read data
- Receive activity with checked box to create instance
- Transform activity
- Invoke activity for writing to output CSV.
I tried this with small input file and everything was OK, but now when I try to use the complete input file, the process doesn't start and automatically goes to OFF state in BPEL console.
Could I use the MaxTransactionSize parameter as in DB adapter, should I batch the input file or other way could help me?
Any hint from you? I've to solve this problem till this thursday.
Thanks,
Milan K.This is a known issue. Martin Kleinman has posted several issues on the forum here, with a similar scenario using ESB. This can only be solved by completely tuning the BPEL application itself, and throwing in big hardware.
Also switching to the latest 10.1.3.3 version of the SOA Suite (assuming you didn't already) will show some improvements.
HTH,
Bas -
Processing an empty file with file adapter
Hi,
We have a scenario where we are merging multiple files via a BPM. One of the files that we read is a delta file, which at times can be blank/empty. The multiple receive steps in the BPM are in one fork and the end condition is set up so that all the messages are received prior to the transformation step.
When we attempt to read an empty file by activating the adapter, the adapter monitor reads that the message was processed successfully. But, no message is created in XI. Is this correct? If yes, is there any way we can create a message for an empty file w/o using a module to change the contents of the file?
Any suggestions or help is greatly appreciated.
Thanks in advance.
Best Regards,
DukeHi Duke,
One suggestion:
You can construct a message with some fields and use exists() function in mapping.
try this link:
http://help.sap.com/saphelp_nw04/helpdata/en/db/83f7b88528424c9113b15d5e0fb516/content.htm
Regards
Priyanka -
One to many xml files with file adaptor
Hi,
I have a scenario HCM-ABAPProxy--XI-File for one structure I need to generate multiple xml files with 100 records per file.
this is my input messag
MT_in
Node
PositionIDs
descrption
job
IsActive
what I was doing on the ABAP side for every node I have 100 PositionID's sub nodes. so each node should be a sperate file.
my output structure is
PositionIDs
PositionID
pid
description
job
so there should be one PositionIDs per file which contains 100 PositionID.
I've multi message mapping without BPM that did not work out just wondering if any one came across the same scenario.
thanks,
JoeYou can not create multiple files without BPM. You can pretty much perform multi mapping to achieve your split but to write it to a file, you will have to call the file adapter for each split which you can not do without using BPM. In BPM, for each split that you perform, you can use a send step in for-each loop which will give you the functionality you require.
Award if helpful,
Sarath. -
Idoc to file with file name as ABCD timestamp and count
Hi,
Greetings!
I have an requirement like iDoc to File and the output file name should be ABCDYYMMDDXX (e.g ABCD14091701) in PI 7.1
where,
Default = ABCD
YY = year
MM = month
DD = date
XX = sequence no. on the same day; e.g. first batch on same day = 01, second batch on the dame day = 02
I tried checking many blogs but its not meeting this requirement.
Kindly please help me out in completing this interface.
Regards,
VinothHi Vinoth,
Below is the code. Use it in-conjunction with your dynamic config code.
String inputFile = "D:\\Receiver"; //This is your target receiver folder
String dateStr = DateFormat.getDateInstance().format(new Date());
dateStr = dateStr.substring(0, 2)+ dateStr.substring(3, 5)+ dateStr.substring(8,10);
final String fileNamePattern = "DEFAULT"+dateStr;
File file = new File(inputFile);
File[] listFiles = file.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if(name.contains(fileNamePattern))
return true;
return false;
//System.out.println("Number of files in the directory "+inputFile+" : Next Counter"+ (listFiles.length+1));
int counter = listFiles.length+1;
String fileName = "";
if(counter < 10)
fileName = fileNamePattern+0+counter;
else
fileName = fileNamePattern+counter;
System.out.println("Name of the file will be:"+fileName);
Hope it helps!
Best Regards,
Anand Patil -
Hi. I'm trying to get my AIR application to load a PDF document from the dialog box using File Reference Class.
With the code that I have if I use a regular Loader then I can get a PNG image to load into a container and display on the screen. But PDF's require HTML Loader which seems not to accept event.target.data because it is expecting a String.
This is the error I got
TypeError: Error #1034: Type Coercion failed: cannot convert "[object FileReference]" to flash.net.URLRequest.
at test_pdf_load_from_dialogfla_fla::MainTimeline/loadFile()[test_pdf_load_from_dialogfla_fl a.MainTimeline::frame1:61]
[UnloadSWF] test_pdf_load_from_dialogfla.swf
Here is my code:
import flash.net.URLRequest;
import flash.display.MovieClip;
import flash.html.HTMLLoader;
import flash.net.FileReference;
import flash.net.FileFilter;
var file:FileReference=new FileReference();
var container:MovieClip=new MovieClip();
addChild(container);
var i:Number=1;
// button is an object on the stage, not being called via actionscript
button.addEventListener(MouseEvent.CLICK, showDialog);
var myFile:FileReference;
var myFileLoader:HTMLLoader;
function showDialog(e:MouseEvent):void{
myFile=new FileReference();
var PDFFileType:FileFilter=new FileFilter("PDFs (*.pdf)","*.pdf");
myFile.browse([PDFFileType]);
myFile.addEventListener(Event.SELECT, selectFile);
function selectFile(e:Event):void{
myFile.addEventListener(Event.COMPLETE, loadFile);
myFile.load();
myFileLoader=new HTMLLoader();
function loadFile(e:Event):void{
myFileLoader.load((e.target).toString());
(with the new forum selection I also can't seem to put this topic into the ActionScript location of the forum for Flash Pro.)Success!!
I was pondering on this subject for several hours when I thought "perhaps the e.target declaration in the loadFile function might contain the "name" property.
When I used a trace statement to test this, my thoughts revealed that to be accurate. The e.target.name call does indeed populate the Output console with the correct file name.
To be sure I did the following:
myFileLoader.load(new URLRequest(String(e.target.name)));
myFileLoader.width=[[set width to anything other than the default of 0 to display the PDF content of the HTMLLoader]]
myFileLoader.height=[[ditto from previous line, the default is 0 which would make the PDF content invisible]].
I am so pleased to have had this inspiration and also to the fact that the ActionScript documentation that I found had good examples to follow. -
Issue in creating bmp file with cl_igs_chart_engine class
Hi All,
I want to populate dynamic graphic in a smartform.
Im using cl_igs_chart_engine class to produce a GIF format of a chart.
Then im trying to use class cl_igs_image_converter to convert that gif into a bmp format using INPUT = 'image/gif' and OUTPUT = 'image/x-ms-bmp'.
but it returns with system failure exception in
call function 'PIGFARMDATA' .
There is no error happening in case of converting any graphic format(bmp,tiff) to gif format but system failure exception occurs while trying to convert into bmp format.
Appreciate your inputs.
Cheers,
VikramHi,
I have taken a copy of program GRAPHICS_IGS_CE_TEST and made changes in it. In std program, file type in customizing XML is 'PNJ'. I changed it to 'BMP' as per your suggestion. However, in the
call method l_igs_ce->execute
exceptions
others = 1.
there is a call function for 'PIGFARMDATA'. Im getting exception error( sy-subrc = 2) for system failure.
This program works fine if the file type in customizing XML is 'GIF' or 'PNG' but not for 'BMP' file types.
Please advice.
Cheers,
Vikram -
Reading HTML / PDF / DOC Files
I tried to read an PDF file using FIleInputStreamReader and tried to print the contents. Some grabage value is getting printed. on tried to read the HTML filre..only the source is getting printed by the printer.
How can i overcome this problemHow are you printing this stuff?
If you want to print files of various formats, for each file type, you need a way to read the file and render it's contents like the regular application does (Acrobat Reader, Word, etc) and print that rendered output. You can't just send the file as text and have it print correctly. Whatever you do to print the text file works for text files only. HTML works the way it does cuz it's a text file which the browser interprets the markup in it to make it look nice. But you aren't rendering that HTML, you're just printing the text in the file, which includes the markup. The PDF and DOC files are even more different, they are binary formats.
Whatever you are calling to get the text files to print is not some magic code that's going to interpret and render any file format you give it. That's why there are different programs for viewing PDFs and DOCs and HTML files and the like instead of one magic do-it-all program that can read/write any file type. -
How to create a .java file with multiple classes
I have all the below classes declared in a file say ABC.java under
a common package called somepackage
Abstract class A
Void abstract metod1();
Void metod2();
Class B
void method3();
Void method4();
Class C
void method1();
Void method2();
In Client.Java
On compiling the Client.Java I get errors
Import somepackag.*;
Class Samp extents A
void Method1()
Public class Client
A a1 =new Samp(); //error undeclared class A
B b1 = new B1();//error undeclared class B
C c1 = new C1();//error undeclared class C
is it possible to have all the class declared in one file ( i dont need mutiple classes, as this file will be autogenerated , i need all classes in one file) and use the classes inside this in the some client app
regards
MPPeetzore wrote:
As long as you have only one public class and your .java file is named after it you shouldn't have any problem.I did exactly that, but still i get the same error "Cannot find symbol"
i have used the import command on top as import somepackage.*;
Edited by: mpjava on Jun 2, 2009 1:29 AM
Edited by: mpjava on Jun 2, 2009 1:30 AM
Maybe you are looking for
-
Can't search events in ical older than 1 yr on iPhone 4 since upgrading to OS7
This is a serious flaw. I found myself at Mayo clinic relying on searching my iPhone ical to look up past medical events. But I had upgraded to iOS 7 just B4 going & found SEARCH mode on iCal didn't find any event older than 1 year. Called Apple for
-
Saving PNG file with transparency
Hello! In my application I generate "BufferedImage"s with transparent pixels. When I try to write them using ImageIO.write() in PNG format, the transparency information is lost. Can anybody send me working code for this problem? Thanks, Norbi
-
Adding Google Adsense to iweb pages
In a previous posting, I was told that I could add the adsense code into my iweb website. I publish via .mac and cannot locate where the html is on my mac in order to add the code I need...anyone who can walk me through that would be a real angel! Da
-
Javax.rmi.*;
Hai..., I have a problem of API javax.rmi.PortableRemoteObject; when I compile a class using java 1.3, it can't find the API,where I should find this API? if in java.sun.com where is it? Thank, ciou, sudarto
-
What is the best way to continuosly back up itunes music?
I have an external hard drive and I copied my itunes folder onto it for an initial back up. I'm continuously adding music and would like to know if there's an easy way to add just the new music I upload every week to the "itunes backup" folder on the