Listing files of a specific format in a JList

I am using the following code to list the file in a directory in a JList, the problem is that I only want files of a specific format to be listed. Is there any way to do this?
public static void listfile() {
     File[] files = directory.listFiles();
     Arrays.sort(files);
     list.setListData(files);
}

Horrible pseudocode is right.
Use a FileNameFilter and learn to read the API so you
don't have to ask dumb questions again.I appreciate youre trying to help, but calling my question stupid is illogical concidering that the java forums are for all questions with relevence to Java and not just the ones you don't find to stupid. Fortunatly I don't hold a grudge and I don't have a death-ray at my disposal right now ;-)

Similar Messages

  • File with list of .txt files in a specific directory

    Hi,
    I need to create a file with list of .txt files in a specific directory (actually the command will be used by a java application).
    I am using the below command,
    ls home/apptmt/park/*.txt > home/apptmt/park/reportgen.txt
    but this command prints output as
    home/apptmt/park/report1.txt
    home/apptmt/park/report2.txt
    home/apptmt/park/report3.txt
    I need only the files in reportgen.txt file, like
    report1.txt
    report2.txt
    report3.txt
    any one help me on the command I should use to get this output?
    Thanks
    MT

    Thank you Dude!
    I just found out that
    cd /home/apptmt/park;ls *.txt > reportgen.lst works for me...
    I will try this one as well... thank you very much...
    MT

  • I have written a binary file with a specific header format in LABVIEW 8.6 and tried to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I have written a binary file with a specific header format in LABVIEW 8.6 and tried  to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I can think of two possible stumbling blocks:
    What are your 8.6 options for "byte order" and "prepend array or string size"?
    Overall, many file IO functions have changed with LabVIEW 8.0, so there might not be an exact 1:1 code conversion. You might need to make some modifications. For example, in 7.1, you should use "write file", the "binary file VIs" are special purpose (I16 or SGL). What is your data type?
    LabVIEW Champion . Do more with less code and in less time .

  • List opened file of a specific directory

    Hi, i would like to list all opened file of a specific duirectory. Maybe I could try to open all files in exclusive mode and catch the exception if the file already open. But i don't know how to open a file in exclusive mode. If you know a better way to do that you are welcome.
    Don't forget that no matter what program already open the file... it could be word, notepad... I'm working on windows, sorry :) !!!
    Thanks
    Zoop

    I also need to make the items in the list click'able so that I can press the display_name and then get the item displayed.
    I have now tried to make a procedure in the portal schema:
    as
        v_tal   number := 0;
        CURSOR tidCursor1 IS
            select DISPLAY_NAME, DESCRIPTION, TO_DATE(PUBLISH_DATE,'DD-MM-YYYY') DATO from portal.wwsbr_all_items WHERE CAID=53 and CATEGORY_ID=8992 order by ID desc;
        begin
            htp.p('<table border=0 width=100%>');
            FOR tidRec IN tidCursor1
            LOOP
                htp.p('<tr><td><b><font face="Arial" size="2" color="#014353">' || tidRec.DISPLAY_NAME || '</font></b><br><font face="Arial" size="1" color="#859CA6"> Skrásett tann ' || TO_CHAR(tidRec.DATO,'D. Mon ´YY') || '</font></td></tr><tr><td><font face="Arial" size="1" color="#014353">' || tidRec.DESCRIPTION || '</font></td></tr><tr><td> </td></tr>');
                v_tal := v_tal + 1;
                EXIT WHEN v_tal >= tal;
            END LOOP;
            htp.p('</table>');
    exception
    when others then
        null;
    end;But now I'm in doubt of how to insert a link to the item itself.
    I'm running portal 10.1.4, so it has path-names that go like this:
    htto://host.domain:port/portal/page/portal/myPageGroupName/PageName/SubPageName etc.
    How can I get an url to these items, that I can be sure will work. What table can I use for that?
    Thanks,
    Botzy
    Message was edited by:
    Botzy

  • How to conver a BINARY Table in specific format Documento to send by e-mail

    Hello all
    i am trying to send a file that is located in application server, this file was created in BINARY MODE, so now i need to download from this server and then send it by e-mail, i haver already download in BINARY MODE but when i send it and i open this appears in BINARY MODE i need to see in the specific format, for example:
    I have a FILE.XLSX which is BINARY MODE in the server and i used this function to download it
    CALL FUNCTION 'C13Z_RAWDATA_READ'
        EXPORTING
          i_file           = input_file
        IMPORTING
          e_file_size      = lv_file_size
          e_lines          = lv_lines
        TABLES
          e_rcgrepfile_tab = it_tab
        EXCEPTIONS
          no_permission    = 1
          open_failed      = 2
          read_error       = 3
          OTHERS           = 4.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        w_doc_data-doc_size = lv_file_size.
        LOOP AT it_tab INTO wa_itab.
          t_attachment-line   = wa_itab-orblk.
          APPEND t_attachment.
        ENDLOOP.
      ENDIF.
    fter to recive the file in binary mode i move it to the internal table  t_attachment, after that i send it by e-mail,
    w_doc_data-obj_langu  =  sy-langu.
      w_doc_data-obj_name   =  'EDISO'.
      w_doc_data-obj_descr  =  ld_mtitle.
      w_doc_data-sensitivty =  'F'.
    *--> Crea el cuerpo del mensaje
      t_packing_list-transf_bin =  space.
      t_packing_list-head_start =  1.
      t_packing_list-head_num   =  0.
      t_packing_list-body_start =  1.
      DESCRIBE  TABLE  it_mensaje  LINES  t_packing_list-body_num.
      t_packing_list-doc_type  =  'RAW'.
      APPEND  t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin  = space. "'X'.
      t_packing_list-head_start  =  1.
      t_packing_list-head_num    =  1 ."5.
      t_packing_list-body_start  =  1. "5.
      IF t_attachment[] IS NOT INITIAL.
        DESCRIBE  TABLE  t_attachment  LINES  t_packing_list-body_num.
        t_packing_list-doc_type   =  c_format. THIS IS THE FORMAT I NEED TO SEE THE FILE FOR EXAMPLE: XLSX
        t_packing_list-obj_descr  =  ld_attdescription.
        t_packing_list-obj_name   =  ld_attfilename.
        t_packing_list-doc_size   =  t_packing_list-body_num * 255.
        APPEND  t_packing_list.
      ENDIF.
    But when i open the mail and open the file attach appears in BINARY so i need to see in XLSX format,
    Thanks a lot for you help

    Thanks for you help

  • How to convert FLV and F4V files to other media formats

    How to convert FLV and F4V files to other media formats
    Nowadays, every one can download their favorite videos from video sharing websites like YouTube, Hulu, MySpace, Google Video, metacafe, Yahoo! Video, Reuters.com and so on at will. However, these video files we got are usually in the format of FLV, or F4V, which are not workable by most portable devices, or some video players and video editors on our PC. With the intention of solving these problems, this guide will show you how to convert FLV and F4V files to other video and audio formats in detail.
    1. Download, install and run Pavtube FLV Converter
    As soon as you run this program, the following wine red interface will show up:
    2. Add files, set output format and destination folder
    Input FLV and F4V files to this program by clicking on “Add” button, and select a format as the output format in the drop-down list of “Format”, meanwhile, you can press the output folder to specify the destination folder or just use the path set by default. Moreover, “merge into one file” enables you to combine multiple FLV and F4V files to be as a single file, if you have this needs, just tick it.
    3. Set advanced settings
    Click “Settings” button, the following interface will pop up. You can change the parameters like screen size, bit rate, frame rate, sample rate, etc. on it to optimize the output quality or compress file size.
    4. Convert
    After all settings are done, you can press “Convert” button to start transferring, and then the following window will show you the conversion info in detail. According to the info you can manage your time and disk space properly.
    Pavtube FLV Converter can definitely complete the conversion at a swift speed with excellent quality; also it adopts an advanced audio-video sync technology, so that audio and video match very well in the resulted files. Therefore you need not worry about these issues.
    Useful tips:
    Free online FLV downloader:
    www.convertdirect.com
    http://vixy.net/
    http://www.videoconverterdownload.com/online-free-flv-converter.html
    http://www.flv2mp3.com/
    http://www.mediaconverter.org/
    http://2conv.com/
    http://online.movavi.com/
    http://www.youconvertit.com/
    http://www.playtube.com/
    http://www.convert.net/

    Flip4Mac

  • Hi, I have problem with importing MOV files from SJCAM 4000. MOV files are in supported formats for Adobe Premiere Elements 11. But if I'm importing MOV file, only audio part is imported, video part is not imported. How can I solve this problem?

    Hi, I have problem with importing MOV files from SJCAM 4000. MOV files are in supported formats for Adobe Premiere Elements 11. But if I'm importing MOV file, only audio part is imported, video part is not imported. How can I solve this problem?

    haben
    From looking at the specifications of your camera (SJCam 4000), we know already what video compression your camera is using. It is H.264.
    A H.264.mov file should be supported by Premiere Elements 11. On what computer operating system is your Premiere Elements 11 running?
    Do you have the latest version of QuickTime installed on your computer? And, are you running QuickTime and Premiere Elements 11 from a
    User Account with administrative privileges? Please go to Premiere Elements 11 Publish+Share/Computer/QuickTime to confirm that you find
    presets there for the QuickTime choice there.
    What are the properties of these H.264.mov files - is it 1080p30 (1920 x 1080p30)  or something else? Do you know if this camera is recording with a variable or
    a constant frame rate?
    Please review and consider and then we will decide what next.
    Thank you.
    ATR

  • Write file in UTF-16BE Format

    I am programming web page that runs SWF file (Flash movie) and servlet.
    The SWF file sends with URL command data to the server.
         send_lv.sendAndLoad("http://�", result_lv, "POST");The data at � UTF-8 (UTF-8 is the standard encoding for exchanging text, such as online mail systems. UTF is an 8-bit system.).
    At the servlet in doPost command I get the data with
    String temp = request.getParameter("smstext");I need to write the parameter �temp� into file in UTF-16BE Format, how I do it?
    I try almost everything

    Once you've got a String, you can get bytes corresponding to a specific encoding with the getBytes(String charset) method.
    In your case:byte[] bytes = temp.getBytes("UTF-16BE");Then you may write those bytes to a file using a FileOutputStream.
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#getBytes(java.lang.String)
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileOutputStream.html
    You should obtain the same result with an OutputStreamWriter, for which you can specify the encoding in the contructor, and then write the String directly:OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-16BE");http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStreamWriter.html

  • Creating a flat file in the IDOC format

    Hi everybody,
    Need help.....urgently. Can somebody please tell me how to create a flat file in the IDOC format? I am creating a bill of lading/Documentary payments (EDI 858) and can't figure out a way to write the data generate through the report in a flat file in IDOC format. My deadline is right around the corner and I need help.
    Thanks,
    M

    Hi Minal,
    I still don't understand your question.
    So, you have a report which selects data and puts it into an internal table.  This part looks fine.
    You want to create a flat file?  Ok, to create a flat file on the application server then use the commands OPEN DATASET, TRANSFER, and CLOSE DATASET.  To create a flat file on the presentation server then use the FM GUI_DOWNLOAD (or the GUI class, I forgets its name for the moment).
    In both cases you should build up an internal table which has the exact structure required for your (EDIFACT?) EDI message, and then use the appropriate method to write the file.
    If the following steps are manual then there is nothing more for you to do.
    I don't see any need to use Idoc technology, or make any reference to it in your solution.
    I hope that helps.  If not, please be more specific when asking your questions.
    Brad

  • List files stored in a Directory Object

    Hi,
    I looked on Google, on Oracle DB docs and here to find a convenient way to list files stored in a DIRECTORY for batch loading in a table with PL/SQL. But no luck, UTL_FILE doesn't seem to have a method for directory listing. I saw examples with some workaround like putting files list in a text file prior to loading. The directory is feeded by other process and network services, so I don't know the filelist that I need to import and, then delete. I dont have access to the server console and it's impossible for me to dump a kind of «dir» result into a text file. I saw other examples using Java, but it looks like I don't have access to Server Side Java too.
    Is there a simple way to do that in PL/SQL only?
    If not, I'll ask to the DBA the necessary rights to compile/run java on the server side...
    The DB target versions for this requirement are 10g and 11g (mainly) on Windows environment.
    Thanks
    Bruno

    brlav35 wrote:
    The XUTL_FINDFILES seems to be the more convenient way. If that works for you, I certainly have no objection. In a lot of environments, though, that package would be problematic.
    1) It must be installed in the SYS schema. That's generally frowned upon and lots of sites would never allow user code to go into the SYS schema. Chris is a bright guy, so I'm sure the risk of it causing harm is minimal (most likely during an install or upgrade), and it will almost certainly never cause you harm, but that would be a political show-stopper at a lot of places.
    2) The package body is wrapped (if there is a version with the package body in clear text, this point is moot). Again, Chris is a well-respected guy, so I have every confidence that the code is not malicious, but asking a DBA to install a wrapped package you downloaded from the internet into the SYS schema on a production database should generate a crud-load of red flags. This is almost certainly just a theoretical danger, but DBAs and audit compliance regulations care a great deal about theoretical dangers. If someone hacked the web site and uploaded their own wrapped bit of code that had a back door, for example, it would be very hard to catch.
    3) Under the covers, the package is querying one of the undocumented X$ views. Oracle is free to change those views over time, which would potentially cause the package to stop working or stop working correctly in some way. If you're developing code for a system that may be around for a number of years, that becomes a concern. It's unlikely that Oracle will change the particular X$ view that is being referenced here over the lifetime of your code base, but it's more than a trivial concern.
    4) The package is determining what directories a user has access to, that's not Oracle enforcing the restriction. Probably not too big a deal, but it is probably safer from a regulatory compliance standpoint to be able to rely on Oracle the database enforcing privileges rather than relying on a delivered package to enforce those privileges. It's the difference between telling Oracle via specific grants which directories the JVM can access vs. writing your own wrapper that enforces those restrictions. In the end, the restrictions are enforced, but in one case you're relying on the developers of the Oracle database and in the other you're relying on external developers.
    Just to re-iterate-- Chris is a brilliant guy, I don't mean this in any way to impugn him or his code. I am totally confident that his code works, that it works well, and that it will continue to work going forward. My concerns are purely on the political/ regulatory side of things, not on the technical side of things. Technically, I am confident that the code is top-notch.
    Justin
    Edited by: Justin Cave on Sep 9, 2009 12:38 PM
    I wrote this before seeing the last few bits of the exchange where you and Chris already talked about the first point.

  • Can I list files on local drive in tab in a particular sort order?

    I find it useful to have Firefox list files on a local drive or network drive such as:
    file:///u:/captures/
    Is there a way to have it list in the files in a tab in a particular order such as newest to oldest?

    I'm not sure (based on your description) if you did or did not try this already... Most of those network drives have a USB 2.0 port. Have you tried connecting it directly to the computer, and deleting those files? You may also want to do your mass file copy to it connected this way, to speed up the transfer.
    If you are able to do this type of connection with the drive, run Disk Utility. Select the drive in the sidebar and look at the bottom of the Disk Utility window. Note what it says for +Partition Map Scheme+. Then select the volume under the drive in the sidebar. Note what it says for Format. Ideally, for use with Intel Macs, the +partition map scheme+ should be *GUID Partition Table*, and the Format should be *Mac OS Extended* or *Mac OS Extended (Journaled)* (the Journaled part is not that important - it can be turned on and off).
    If the format is something like FAT32 (a Windows PC format), that may be a problem. Although Mac OS X can read from and write to FAT32, I have read that FAT32 has some upper limit on file size, and there may be other issues with copying from a Mac OS formatted volume to a FAT32 volume, such as file name length and naming convention.
    If you want network storage that will work with no hassles, there's the newly refreshed Time Capsules.
    http://store.apple.com/us/product/MB765LL/A/Time-Capsule-1TB?mco=NDkyMTcwMg
    Now with 1TB or 2GB of built-in storage and dual-band wireless networking. The older version without the dual-band wireless at 1TB is available as a refurb for a bit less.
    http://store.apple.com/us/product/FB277LL/A?mco=NDkwNjU0NA
    Perhaps overkill just to get network storage (since a Time Capsule is also a wired/wireless router), but I have an older AirPort Extreme Base Station (basically a Time Capsule without the storage). It is my main router, and I have connected a regular USB 2.0 drive to it for network storage (it has a USB port). It work fine with no hassles. The AirPort Utility is very easy to understand and use.

  • Cannot open file in the "GenRandom290" format

    Just updated yosemite and when I go to open a file i get the message cannot open file in the "GenRandom290" format. Before i updated never had a problem.

    Hi,
    In the current format of the Apple Discussions you can "tag" a Thread starting post with the sub folders such as the "Mail" section or "Messages" and other App based section or ones like "Using Yosemite" to pin down the knowledge you need.
    The experienced posters can add the word Content at the base level of the Forum folder like this
    "https://discussions.apple.com/community/mac_os/os_x_yosemite/content"
    This changes the View but you can then select a specific section.
    I use Messages which converts to:-
    OS X Yosemite
    So in looking for posts about the Messages app I found this Thread tagged for Messages.
    The issue is not one I recognise from Messages.
    If you Right Click the File and use the Open With option what do you see ?
    This might tell us what area we should be looking at.
    Example of  Screen Shot on my Desktop
    8:37 pm      Tuesday; February 3, 2015
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Print pdf files on a A4 format

    Dear all,
    When I want to print my pdf files on a A4 format- one page per paper, the document is printed on the half of the paper.
    I encounter this problem on the Acrobat Adobe X series, hence it was not the case with previous editions of Acrobat Reader. This phenomenon occurs on several printers so this issue might be linked to the Acrobat Reader rather then to the printer.
    Has someone yet encountered this phenomenon? If yes, how did you solve it?
    Thanks!

    Are the documents A4?
    Have you set the Page Scaling, on or off, to your prefererence? (Page Scaling is an option from the print dialog)
    Check and disable any features for Paper saving, or n-up from the printers features. (From the print dialog, the Advanced button enables features specific to the printer)

  • "File Import Failure Unsupported format or damaged file" in CS6 but fine in CS5.5

    Hello All.
    Recording in Pal DV AVI from Sony Z5U with MRC1K compact flash recorder.
    Imported files to computer using the Sony utility, and also tried dragging and dropping.
    Some files import to Premiere Pro CS6.03, but others give "File Import Failure: Unsupported format or damaged file,".
    The files that do import show up as 4:3 and I have to modify /  interpret footage to get them to show as 16:9,
    However, these same files play back just fine in Windows Media Player.
    Intriguingly these files import just fine to Premiere Pro CS5.5, and also show up correctly as 16:9.
    I can't figure out why some files import into CS6 and others don't....
    Anyone else seen this kind of behavior?
    (Normally I record in HDV and I've never had problems importing from MRC1K into Premiere, but the client specifically requested DV files for their ease of editing...)
    Cheers
    Mark
    PS When I use the DV recoverer utility on these files they import just fine into CS6....

    Hi Jim,
    OK, here's the video that imports OK into CS6.03 but that Premiere CS6.03 sees as 4:3:
    And here's the one that won't import into CS6.03 but is happily opened by CS5.5 and correctly seen as 16:9:
    Can you spot the difference? Thanks for having a look at this.
    Cheers
    Mark

  • CAMl Query -CSOM - Display Modified date of list Item in a required format

    Hi All,
    I want to display last modified date of a List Item.
    I am getting the value in this format : 
    Tue Feb 25 23:06:57 PST 2014
    How ever, I want to display it as : Tuesday 25th February 2014
    Please suggest how to achieve this.
    Any informative articles, links w.r.t building such queries in CSOM (jQuery) is welcome.
    Thanks.

    I have the query : 
    function ReadListItem() {
                siteUrl = "my site Url";
                var listTitle = "NewsList";
                //Get the current client context
                var context = new SP.ClientContext(siteUrl);
                var newsList = context.get_web().get_lists().getByTitle(listTitle);
                var camlQuery = new SP.CamlQuery();         
                camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name=\'Modified\' Ascending="FALSE"/></OrderBy><RowLimit>1</RowLimit></Query></View>";')
                this.listItems = newsList.getItems(camlQuery);
                context.load(listItems);
                context.executeQueryAsync(ReadListItemSucceeded, ReadListItemFailed);
            function ReadListItemSucceeded(sender, args) {
                var itemsString = '';
                var enumerator = listItems.getEnumerator();
                while (enumerator.moveNext()) {
                    var listItem = enumerator.get_current();
                    itemsString += 'Modified On: ' + listItem.get_item('Modified');
                $("#P1").append(itemsString);
    I am able to get the Modified Date using the query
    But I need it in a specific format like : Tuesday 25th February 2014
    Please suggest

Maybe you are looking for

  • Taxinj and taxinn

    Hi Experts I am using Taxinj Excise duty will flow through tax codes which we have created,now what i want to know eventhough i have to create fv11 for BED condition. Please focus on this issue. Rgds ana.

  • Article/References to XI/PI Message Flow

    Does anyone have any good articles or references that show how a message flows into and out of XI/PI?  Im specifically looking for something that shows how the message hits the communication channels and goes through the sender agreements, receiver a

  • Using NAS Drive during editing.

    Ok so I'm about to make a big purchase because I'm sick of Hard Drives failing on me.  I'm going with a NAS device that takes 4 HD's and then I can RAID half of them to be mirrored.  Only problem is, can I have my source clips on it's network while I

  • Batch Number problem

    Hi, When i check the Batch Transaction report, I find Batch Number and qty and Whse. But when i try to issue, Iam getting quantity fall into negative inventory. The stock is not showing in the whse althought in the Batch report, it is showing as qty

  • Why do I have to keep downloading iTunes?

    I have had iTunes on my computer forever. But today when I went to download some content I subscribe to, I was made to download ITunes as though I had never had it.. I did so, restarted my computer, and get the same thing over and over.