Can I store .txt files in a jar and read them?
I have searched the forum and didn't find exactly what I needed.
I have multiple .txt files that will most likely not change over time. I have a class that reads them as needed. I need to do this in a jar file but can not seem to read the .txt files.
Any help?
You should be able to read them using an idiom like this:
URL textURL = MyClass.class.getResource("res/txt/TextResourceFile.txt");where MyClass is the name of a class, and the specified path is relative to the location of that class.
I haven't actually tried this for text files, but I do use it to load images, so it ought to work for this too.
Similar Messages
-
Large XML files, how to split and read them in PI
Hi,
For a specific requirement, we have a 60 MB-90 MB XML file being generated by a legacy application.
This file has to be processed by PI 7.31 Sender File Adapter and should be posted as a ABAP proxy to SAP ECC system.
To address any performance issues, we are planning to read the files in chunks.
Is there a way by which we can configure the file adapter to pick a fixed no.of records to limit the size.
In inputs in this regard will be appreciated.
regards,
YounusHi Younus,
First of all if you are using PI 7.31, then you should be quite able to process XML file of about 100MB scale. Performance issue shall occur in ECC side instead as it can not handle such high volume.
My suggestion will be to pick the whole XML file at one go and do necessary mapping. However on receiver side use SOAP Adapter instead of XI for making proxy calls to ECC.
In SOAP adapter (using HTTP as Transport and XI 3.0 as Message protocol) there's an option as 'XI Packaging' which can be used to send data in packets.
Refer below help doc on it.
Configuring the Receiver SOAP Adapter - Advanced Adapter Engine - SAP Library
Thanks
Bibek -
Can I store the files on the web, and link to open?
Hi, all, and thank you for the prior help. I'm using Captivate 5, and have managed to get some nice presentations into Desire 2 Learn. However, I will quickly use up my alloted memory, and I'm looking for an alternative.
Through Amazon, I have 5 GB free storage space. What I envision is storing my published presentations there, and just linking to them through the LMS. I cannot get this to work, though. I've tried putting all of the files (extracted) into the storage space...then I click on the swf file and a window opens but doesn't display anything. I also tried clicking on the html file, and nothing. Any ideas, or am I thinking about this in the wrong way?
Thanks, thanks and thanks,
MegHi Meg
Are you using Amazon S3? If so, good luck! I have an S3 account and it's a nightmare figuring out what the silly URL should be to things.
Cheers... Rick
Helpful and Handy Links
Captivate Wish Form/Bug Reporting Form
Adobe Certified Captivate Training
SorcerStone Blog
Captivate eBooks -
Can I use mp3 files on my computer and put them on an I pod touch?
I am looking to buy an I pod touch, but I want to know if I can transfer my mp3's from my computer to the I pod. OR do I have to use I Tunes?
You can use your MP3's and you will have to use itunes to sync them.
You will need to put the music in itunes. From there you can sync it to the ipod. -
How can i put txt files in my i phone 4
how can i put txt files in my i phone 4
There are many apps for this.
I use idisk with mobileme.
You can search the apps store or do a forum search and find several others. -
Can i store my files on time capsule from my ipad, and copy them back, without using itunes to sync the tablet? i want to buy an iPad Air and to forget my laptop and i think that even the 128 gb wont be enough some times. I am wandering if time capsule can be used as external hdd and to connect on it via wifi ...
No. You cannot access your Time Capsule directly from an iOS device. The only way to back up an iOS device is to a computer through iTunes or to iCloud, though in some cases you can open and save files via another cloud-based service such as Dropbox.
Regards. -
Can't Import txt file in QTPro
I am trying to add Chapter Markers to a quicktime movie prior to bringing it into iDVD. Following the instructions in "QuickTime Player Help" section I made a txt file with chapter titles and timecode in the correct script. The "help" sheet tells me to "Save the text file and import it into QuickTime Player." Great- but there is no "import" choice in the drop down menu under "File."
I have deleted QuickTime and reimported it three times and tried re-purchasing QTPro. What am I not doing correctly?
Thanks,
A.
Dual 1 GHz PowerPC G4 Mac OS X (10.3.9) 1.5 GB SDRAM
Dual 1 GHz PowerPC G4Kirk-
I did write as plain text but found my own error elsewhere. I had inadvertantly added a carriage space after each chapter marker. When I brought them into QuickTime the first time, these carriage returns created a space for a new chapter heading after each real chapter heading. When I applied time code placements to my real titles, I did not understand I had also created bogus, blank titles. These had non-sense time code stamps and so QuickTime rejecting the file.
"Open File" replaces the "Import File" command in this version but all is well. User error.
Thanks,
A.G. -
hi, i purchased a 2 dvd digital set. i cant just download it straight to my ipad. they said i have to down load it to my i tunes, then can transfer to i pad. im not seeing how to click the files from my email, and get them into the i tunes acct... ugh.
i do not have a mac home pc. just a regular pcI had the same problem after I gave my old iPad to my parents and tried to install Netflix. This is what you have to do: Open iTunes on your computer, the one you sync your iPad to. Then go to iTunes Store and search for and download Netflix app. After you download it, if your iPad is set to download new purchases it may start downloading on your iPad. If so, tap and hold to delete the app (because it is trying to install the new version on the iPad) Next step, go to the App Store on your iPad and find Netflix and it should say install since you already purchased it on the computer. Tap to install, and it will say the version is not compatible, tap to download a previous version. Click that and it will install the older version! One more thing, if and when you sync to your computer again it will say something like " Unable to install Netflix on your iPad" Just click the box to never remind you again, because it's trying to sync the newer Netflix app to your iPad, but it doesn't work so it displays the message. The old app will remain on the ipad. Hope this helps, good luck
-
How to pack image files in jar and reference them
I have a utility project that is used by other applications. I am wrapping the package up in a jar file. The project that is wrapped in the jar file references some jpg file. Can I put those files in the jar? If so, how do I reference them in the code?
Can I put those files in the jar? Yes.
If so, how do I reference them in the code?I bet nobody has asked that question before.
HINT- search.
EXTRA HINTS - getResource, getResourceAsStream -
Can I store iphoto pictures in time capsule and use with pad
Can I store iphoto pictures in time capsule and use with pad
We can tell you that it is possible to store separate images on the Time Capsule drive. If however, you are asking if you can access separate images from your Time Machine backups on the Time Capsule, this is not possible.
How you get the images that your want from iPhoto on your Mac to the Time Capsule drive is a question for the iPhoto experts. It will likely involve "exporting" the files that you want and then moving them using the Finder to the Time Capsule drive.
How you access those images on the Time Capsule from an iPad is a question for the Using iPad experts. -
Problem exporting '.txt' file size 23 KB and '.zip' file size 4 MB
I am using Apex 3.0 version screen to upload '.txt' file and '.zip' file containing images.
I can successfully export '.txt' file and '.zip' file containing images as long as '.txt' file size is < 23 KB and '.zip' file size < 4 MB from database table 'TBL_upload_file' to the OS directory on the server.
processing of Larger files (sizes 35 KB and 6 MB) produce following Error Message.
‘ORA-21560: argument 2 is null, invalid or out of range’ error.
Here is my code:
I am using following code to export Documents from database table 'TBL_upload_file' to the OS directory on the server.
create or replace procedure "PROC_LOAD_FILES_TO_FLDR_BYTES"
(pchr_text_file IN VARCHAR2,
pchr_zip_file IN VARCHAR2)
is
lzipfile varchar(100);
lzipname varchar(100);
sseq varchar(1000);
ldocname varchar(100);
lfile varchar(100);
-- loaddoc (p_file in number) as
l_file UTL_FILE.FILE_TYPE;
l_buffer RAW(32000);
l_amount NUMBER := 32000;
l_pos NUMBER := 1;
l_blob BLOB;
l_blob_len NUMBER;
l_file_name varchar(200);
l_doc_name varchar(200);
a_file_name varchar (200);
end_pos NUMBER;
begin
-- Get LOB locator
SELECT blob_content,doc_name
INTO l_blob,l_file_name
FROM tbl_upload_file
WHERE DOC_NAME = pchr_text_file;
--get length of blob
l_blob_len := DBMS_LOB.getlength(l_blob);
-- save blob length to determine end position
end_pos:= l_blob_len;
-- Open the destination file.
-- l_file := UTL_FILE.fopen('BLOBS','MyImage.gif','w', 32767);
l_file := UTL_FILE.fopen('BLOBS',l_file_name,'WB', 32760); --use write byte option supported in 10G
-- if small enough for a single write
IF l_blob_len < 32760 THEN
utl_file.put_raw(l_file,l_blob);
utl_file.fflush(l_file);
ELSE -- write in pieces
-- Read chunks of the BLOB and write them to the file
-- until complete.
WHILE l_pos < l_blob_len LOOP
DBMS_LOB.read(l_blob, l_amount, l_pos, l_buffer);
UTL_FILE.put_raw(l_file, l_buffer);
utl_file.fflush(l_file); --flush pending data and write to the file
-- set the start position for the next cut
l_pos := l_pos + l_amount;
-- set the end position if less than 32000 bytes, here end_pos captures length of the document
end_pos := end_pos - l_amount;
IF end_pos < 32000 THEN
l_amount := end_pos;
END IF;
END LOOP;
END IF;
--- zip file
-- Get LOB locator to locate zip file
SELECT blob_content,doc_name
INTO l_blob,l_doc_name
FROM tbl_upload_file
WHERE DOC_NAME = pchr_zip_file;
l_blob_len := DBMS_LOB.getlength(l_blob);
-- save blob length to determine end position
end_pos:= l_blob_len;
-- Open the destination file.
-- l_file := UTL_FILE.fopen('BLOBS','MyImage.gif','w', 32767);
l_file := UTL_FILE.fopen('BLOBS',l_doc_name,'WB', 32760); --use write byte option supported in 10G
-- if small enough for a single write
IF l_blob_len < 32760 THEN
utl_file.put_raw(l_file,l_blob);
utl_file.fflush(l_file); --flush out pending data to the file
ELSE -- write in pieces
-- Read chunks of the BLOB and write them to the file
-- until complete.
l_pos:=1;
WHILE l_pos < l_blob_len LOOP
DBMS_LOB.read(l_blob, l_amount, l_pos, l_buffer);
UTL_FILE.put_raw(l_file, l_buffer);
UTL_FILE.fflush(l_file); --flush pending data and write to the file
l_pos := l_pos + l_amount;
-- set the end position if less than 32000 bytes, here end_pos contains length of the document
end_pos := end_pos - l_amount;
IF end_pos < 32000 THEN
l_amount := end_pos;
END IF;
END LOOP;
END IF;
-- Close the file.
IF UTL_FILE.is_open(l_file) THEN
UTL_FILE.fclose(l_file);
END IF;
exception
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20214,'Screen fields cannot be blank, Proc_Load_Files_To_Fldr_BYTES.');
WHEN TOO_MANY_ROWS THEN
RAISE_APPLICATION_ERROR(-20215,'More than one record exist in the tbl_load_file table, Proc_Load_Files_To_Fldr_BYTES.');
WHEN OTHERS THEN
-- Close the file if something goes wrong.
IF UTL_FILE.is_open(l_file) THEN
UTL_FILE.fclose(l_file);
END IF;
RAISE_APPLICATION_ERROR(-20216,'Some other errors occurred, Proc_Load_Files_To_Fldr_BYTES.');
end;
I am new to the Oracle.
Any help to modify this scipt and resolve this problem will be greatly appreciated.
Thank you.Ask this question in the Apex forums. See Oracle Application Express (APEX)
Regards Nigel -
The hard drive on my Macbook Pro is getting full (mainly due to the size of my iTunes library). Can I store it on my time capsule and if so, how is it done ?
You can store your iTunes library on a Time Capsule. So that you can access on your local (home) network (I wouldn't recommend access via the internat), (off site.....to slow).
If you do decide to put your libray on Time Capsule I'd recommend doing this.
Option 1:
1. Don't use TC as a Backup (Time Machine).
2. Connect a USB drive to your TC or Computer and backup to the drive. Backup when a change is made to the library (adding Apps, Songs you get the idea).
Option 2: (What Im doing)
1. Two Time Capsule's connected via ethernet cable (roaming mode, bridge).
2. Use TC1 as a Time Machine backup
3. Use TC2 as network drive. (The information on TC2 does NOT get backed up to TC1).
3a. Connect a USB, FW, drive to your desktop computer (if you have one) use SilverKeeper to schedule backups. Silverkeeper will look at TC2 and back it up to a external or internal HD. I've been doing the or some time now. Or connect to your TC and do an archive.
I have this setup because I don't trust Cloud base services and I want access to my files (in Sync) on TC where ever I am, as long as there's a internet connection. It's expensive, but does exactly what I expect.
The most important thing is to safe guard your data in case of a failure.
In your situation it would probably be better to get a high speed SD or thumb drive, however I've never been successful in backing up those type of drives with TM. What ever you decide to do make sure you have a GOOD duplicate (backup). -
Hi to all friends of JAVA,
I tried to convert my .txt file like this (LIKE ONE IMAGE IN BLACK AND WITHE):
1111111.....
0000111.....
0011111.....
0111111.....
in a white and black image in .png format using:
RenderedImage image = JAI.create("fileload", "probe.txt");
RenderedOp op = JAI.create("filestore", image,"probe2.png" , "png");
but the error is:
Exception in thread "main" java.lang.RuntimeException: - Unable to render RenderedOp for this operation.
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:826)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:866)
at javax.media.jai.RenderedOp.getSampleModel(RenderedOp.java:2232)
at com.sun.media.jai.codecimpl.PNGCodec.canEncodeImage(PNGCodec.java:62)
at javax.media.jai.operator.FileStoreDescriptor.validateArguments(FileStoreDescriptor.java:176)
at javax.media.jai.JAI.createNS(JAI.java:1086)
at javax.media.jai.JAI.create(JAI.java:973)
at javax.media.jai.JAI.create(JAI.java:1621)
at Genim.<init>(Genim.java:158)
at Genim.main(Genim.java:301)
How can I convert this .txt file in a black and with image ????
THANK YOU in advance.
princoI Solved my problem using the Jama Package. Thank you.
-
How can I convert multiple files at one time and not one at a time
How can I convert multiple files at one time and not one at a time
Hi Plissey1950,
Sorry for the lengthy delay to a response. Are you trying to convert multiple files to individual PDF files at the same time? (not combine them). If so, you'll need to use Adobe Acrobat for this function. The CreatePDF service does not have the ability to convert multiple files to multiple individual PDF files.
Thanks,
David -
how can i convert video files from my mac to watch them on my iphone?, how can i convert video files to watch them on my iphone?
Turns out the answer to that question changes if you ask it more than 4 times, so ask it again....
The answer depends on the type of video files you want to convert. If they are DRM protected commercial videos, no help can be given here. Google.
Maybe you are looking for
-
How to increase the width of the drop down list box in SSRS multi value parameter
Hi, I am using SSRS 2012. I have a parameter, which accepts multi value. The width of the drop down list box is very small, and the user need to scroll to the right to view the complete view of the content in the list box. But, if I don't use multi v
-
Crashing of PC while loading latest blackberry link in Windows 8.1
Is there a common issue of PC crashing everytime while loading latest Blackberry link 1.0.28. Even sync with outlook is stopped in windows 8.1. Assistance required.
-
Is there any way so that I Being able to clear out old data from the Order
Hi Friends, Is there any way so that I Being able to clear out old data from the Order Gate forecast, tolerance, and confirmed order to date tables on a monthly basis? Means I want data in data table for particular time (I want that if suppose today
-
Dumb question re iPhone 4 screen
In the upper right corner to the left of the battery percentage, a picture of a lock appeared with an arrow circling it. It just appeared and I'm wondering I did/locked...?
-
Refering alias of a function result in an sql statement
Dear Sir, How to refer an alias of a function result in sql statement? eg.(new_name is the alias) select myfunction(name) new_name from mytable where new_name = '#vincent#'; I can't refer new_name in the above statement coz it gives an error "invalid