How do you write a class to return a file?

So I've read http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html
But I still do not know how to pass a file to a calling method of another class. How does the FileChooser class retrun the file. Please help.

You mean something like this?
import java.io.File;
public class FileTest {
     public File getFile(String path) {
     //Example path =  "C:\\path\\to\\file.txt"
          return new File(path);
}

Similar Messages

  • How do you write an image threshold to a file

    Hi, I use IMAQ threshold to threshold an RGB image. How do I write this image to a file? Whenever I use the IMAQ Write JPG or Write PNG vI and try to view the file with the windows image viewer all I see is a black image. Does anyone know how to save a binary image?

    If you cast it to an eight bit image and save it as a BMP or JPEG does it show up correctly? If so the problem probably lies in the fact that a 16-bit image in LabVIEW is signed, while third party viewers usually assume that it is unsigned. So rather than pixel values going from -32766 to 32767, they go from 0 to 65536. There are example programs on ni.com to get around this. One is called "Mapping a 16-bit Image to an 8-bit Image," another is called "Bit Shift an IMAQ Vision 12-bit Image and Resave for External Viewer." If you search for these titles on the ni.com search bar, you should be able to find them.
    Kyle V

  • How do you write a deterministic clause?

    How do you write / code a deterministic clause? I was told to use it instead of Target buckets
    Thanks,

    This is my target_bucket function. I have been trying to create a rewrite enabled materialized view and I have been able to do that. I was told to use a deterministic clause to be able to make the code into a re-write enable materialized view.
    THIS IS THE TARGET BUCKET CODE / FUNCTION.
    GRP_OR_BCKT_IN CHAR, -- 'G' or 'B'
    PTD_OR_RESV_IN CHAR, -- 'P' or 'R'
    CLM_KIND_IN CHAR,
    CODE_IN CHAR,
    PTD_1 NUMBER,
    PTD_2 NUMBER,
    PTD_3 NUMBER,
    PTD_4 NUMBER,
    PTD_5 NUMBER,
    PTD_6 NUMBER,
    PTD_7 NUMBER,
    PTD_8 NUMBER,
    PTD_9 NUMBER)
    RETURN NUMBER IS
    TEMP NUMBER := 0;
    BEGIN
    SELECT /*+ INDEX(INDICATOR_SUM IDX_INDICATOR_SUM_GRP)*/
    SUM(DECODE(INDICATOR_SUM.INDICATOR,
    1, PTD_1,
    2, PTD_2,
    3, PTD_3,
    4, PTD_4,
    5, PTD_5,
    6, PTD_6,
    7, PTD_7,
    8, PTD_8,
    9, PTD_9,
    0)) INTO TEMP
    FROM INDICATOR_SUM WHERE
    INDICATOR_SUM.GRP_OR_BCKT = GRP_OR_BCKT_IN AND
    INDICATOR_SUM.PTD_OR_RESV = PTD_OR_RESV_IN AND
    INDICATOR_SUM.CLM_KIND = CLM_KIND_IN AND
    INDICATOR_SUM.CODE = CODE_IN;
    RETURN NVL(TEMP,0);
    EXCEPTION
    WHEN OTHERS THEN
    RETURN 0;
    END;
    This is what I've been trying to do with no LUCK AT ALL.
    CREATE MATERIALIZED VIEW M_reserve
    TABLESPACE mviews_TS
    BUILD IMMEDIATE
    Enable query rewrite
    AS
    SELECT
    Reserve.clm_seq_id_fk as clm_seq_id,
    PID.PID_NBR AS PARENT_ID,
    PID.PID_NAME AS PID_NAME,
    ACCT.ACCT_NBR AS ACCOUNT_NBR,
    ACCT.ACCT_NAME AS ACCOUNT_NAME,
    CLAIM_1.CLM_NBR AS CLAIM_NBR,
    CLAIM_1.CLM_SUFFIX AS CLAIM_SUFFIX,
    ACCT_LOI.LOI AS LOI,
    CLAIM_1.CLM_KIND AS CLAIM_KIND,
    CLAIM_1.ST_CLM_NBR AS STATE_CLAIM_NBR,
    ACCT_LOI.RISK_NBR AS RISK_NBR,
    ACCT_LEVEL1.LEVEL_1 AS LOCATION_1,
    ACCT_LEVEL1.LEVEL_NAME AS LOCATION_1_NAME,
    ACCT_LEVEL2.LEVEL_2 AS LOCATION_2,
    ACCT_LEVEL2.LEVEL_NAME AS LOCATION_2_NAME,
    ACCT_LEVEL3.LEVEL_3 AS LOCATION_3,
    ACCT_LEVEL3.LEVEL_NAME AS LOCATION_3_NAME,
    ACCT_LEVEL4.LEVEL_4 AS LOCATION_4,
    ACCT_LEVEL4.LEVEL_NAME AS LOCATION_4_NAME,
    ACCT_LEVEL5.LEVEL_5 AS LOCATION_5,
    ACCT_LEVEL5.LEVEL_NAME AS LOCATION_5_NAME,
    SERV_OFC.SERV_OFC AS SERV_OFC,
    SERV_OFC.SERV_OFC_NAME AS SERV_OFC_NAME,
    CLAIM_1.BEN_ST AS BENEFIT_ST,
    CLAIM_1.CLM_TYPE AS CLAIM_TYPE,
    CLAIM_1.OPN_CLSD AS OPEN_CLOSED,
    SUBSTR(CLAIM_1.CLM_STAT,1,5) AS CLAIM_STATUS,
    CLAIM_1.CLMT_LST_NAME AS CLMNT_LAST_NAME,
    CLAIM_1.CLMT_FIRST_NAME AS CLMNT_FIRST_NAME,
    CLAIM_1.CLMT_MID_INIT AS CLMNT_MIDDLE_INITIAL,
    CLAIM_2.CLMT_ADDR1 AS CLMNT_ADDR1,
    CLAIM_2.CLMT_ADDR2 AS CLMNT_ADDR2,
    CLAIM_2.CLMT_CITY AS CLMNT_CITY,
    CLAIM_2.CLMT_ST AS CLMNT_ST,
    CLAIM_2.CLMT_ZIP_CD AS CLMNT_ZIP_CD,
    CLAIM_2.CLMT_CNTRY AS CLMNT_CNTRY,
    CLAIM_1.CLMT_SSN AS CLMNT_SSN,
    CLAIM_1.DT_INJ AS DATE_OF_INJURY,
    CLAIM_1.DT_RPT_EMPLR AS DATE_RPT_TO_EMPLOYER,
    CLAIM_1.DT_RECV AS DATE_RCVD_BY_GMCD,
    CLAIM_1.DT_INPT AS DATE_CLAIM_ENTERED,
    CLAIM_1.DT_CLSD AS DATE_CLAIM_CLOSED,
    CLAIM_1.DT_LST_ACTVY AS DATE_OF_LAST_ACTIVITY,
    CLAIM_1.DT_REOPN AS DATE_REOPENED,
    CLAIM_1.INJ_CAUSE AS INJ_CAUSE_CD,
    IJCA_DESC.TBL_DESC AS INJ_CAUSE_DESC,
    CLAIM_1.PART_OF_BODY AS POB_CD,
    IJPB_DESC.TBL_DESC AS POB_DESC,
    CLAIM_1.NATR AS INJ_NATURE_CD,
    IJNT_DESC.TBL_DESC AS INJ_NATURE_DESC,
    CLAIM_1.AGCY AS AGENCY_CD,
    AGAL_DESC.TBL_DESC AS AGENCY_DESC,
    CLAIM_1.MANL_CLSR_REQR AS MANUAL_CLASS_NBR,
    CLAIM_1.REC_ONLY AS RECORD_ONLY_FLAG,
    CLAIM_1.SEX AS SEX,
    NVL(DECODE(CLAIM_1.AGE,0,NULL,CLAIM_1.AGE),
    TRUNC((CLAIM_1.DT_INJ - CLAIM_1.DT_BIRTH) / 365.25))
    AS AGE,
    CLAIM_1.TIME_EMPLD AS TIME_EMPLOYED,
    CLAIM_1.DT_MED_TO_INDM AS DATE_MED_CHG_TO_IND,
    CLAIM_1.DT_INDM_TO_MED AS DATE_IND_CHG_TO_MED,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '200',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_MEDICAL,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '201',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_INDEMNITY,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '202',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_EXPENSES,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '203',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_RECOVERABLE,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '204',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_PROPERTY_DAMAGE,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '205',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_BODILY_INJURY,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '206',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_OTHER,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '207',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_CONTENTS,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '208',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_STRUCTURES,
    TARGET_BUCKET('G','R',
    DECODE(PID.CONV_FLAG,'Y',CLAIM_1.CLM_KIND,'WC00'),
    '209',
    RESERVE.RESV_1,
    RESERVE.RESV_2,
    RESERVE.RESV_3,
    RESERVE.RESV_4,
    RESERVE.RESV_5,
    RESERVE.RESV_6,
    RESERVE.RESV_7,
    RESERVE.RESV_8,
    RESERVE.RESV_9) AS RESV_RECOVERY,
    CLAIM_1.DT_DEATH AS DATE_OF_DEATH,
    CLAIM_1.INJ_CLASS_CD AS INJ_CLASS_CD,
    ICLA_DESC.TBL_DESC AS INJ_CLASS_DESC,
    CLAIM_1.OCCUP_CD AS OCCUPATION_CD,
    CLAIM_1.OCCUP AS OCCUPATION_DESC,
    CLAIM_1.NATR_OF_INJ AS INJ_NATURE,
    CLAIM_1.ACCD_DESC AS ACCIDENT_DESC,
    RESERVE.DT_INPT AS DATE_RESERVE_ENTERED,
    RESERVE.TIME_INPT AS TIME_RESERVE_ENTERED,
    RESERVE.RESV_OTH_DESC AS RESV_OTH_DESC,
    ASSOCIATE.HP_LOGON AS FIELD_OFFICE,
    ASSOCIATE.USER_LST_NAME AS EXAMINER_LAST_NAME,
    ASSOCIATE.USER_FIRST_NAME AS EXAMINER_FIRST_NAME,
    ASSOCIATE.SUPV AS EXAMINERS_SUPERVISER,
    ASSOCIATE.MGR AS EXAMINERS_MANAGER,
    CLAIM_1.BUS_UNIT AS BUSINESS_UNIT,
    CLAIM_1.CLM_CLASS AS CLAIM_CLASS,
    CLAIM_1.NURSE_RESP AS NURSE_RESPONSIBLE,
    CLAIM_2.EMPL_NBR AS EMPL_NBR
    FROM
    ACCT,
    ACCT_LOI,
    PID,
    INCIDENT,
    CLAIM_1,
    CLAIM_2,
    ACCT_LEVEL1,
    ACCT_LEVEL2,
    ACCT_LEVEL3,
    ACCT_LEVEL4,
    ACCT_LEVEL5,
    RESERVE,
    SERV_OFC,
    ASSOCIATE,
    AGAL_DESC,
    IJCA_DESC,
    ICLA_DESC,
    IJNT_DESC,
    IJPB_DESC
    WHERE
    CLAIM_1.OPN_CLSD <> 'Z' AND
    PID.PID_SEQ_ID = ACCT.PID_SEQ_ID_FK AND
    ACCT.ACCT_SEQ_ID = ACCT_LOI.ACCT_SEQ_ID_FK AND
    INCIDENT.ACCT_LOI_SEQ_ID_FK(+) = ACCT_LOI.ACCT_LOI_SEQ_ID AND
    CLAIM_1.INC_SEQ_ID_FK(+) = INCIDENT.INC_SEQ_ID AND
    CLAIM_2.CLM_SEQ_ID_FK = CLAIM_1.CLM_SEQ_ID AND
    RESERVE.CLM_SEQ_ID_FK(+) = CLAIM_1.CLM_SEQ_ID AND
    SERV_OFC.SERV_OFC_SEQ_ID = CLAIM_1.SERV_OFC_SEQ_ID_FK AND
    ACCT_LEVEL1.LEVEL1_SEQ_ID(+) = CLAIM_1.LEVEL1_SEQ_ID_FK AND
    ACCT_LEVEL2.LEVEL2_SEQ_ID(+) = CLAIM_1.LEVEL2_SEQ_ID_FK AND
    ACCT_LEVEL3.LEVEL3_SEQ_ID(+) = CLAIM_1.LEVEL3_SEQ_ID_FK AND
    ACCT_LEVEL4.LEVEL4_SEQ_ID(+) = CLAIM_1.LEVEL4_SEQ_ID_FK AND
    ACCT_LEVEL5.LEVEL5_SEQ_ID(+) = CLAIM_1.LEVEL5_SEQ_ID_FK AND
    ASSOCIATE.PROCS_UN(+) = CLAIM_1.EXAMR_RESP AND
    ASSOCIATE.SERV_OFC_SEQ_ID_FK(+) = CLAIM_1.SERV_OFC_SEQ_ID_FK AND
    (AGAL_DESC.TBL_TYPE = ACCT_LOI.AGCY_CD_TBL OR
    AGAL_DESC.TBL_TYPE IS NULL) AND
    AGAL_DESC.TBL_CD(+) = CLAIM_1.AGCY AND
    ICLA_DESC.TBL_CD (+) = CLAIM_1.INJ_CLASS_CD AND
    IJCA_DESC.TBL_CD (+) = CLAIM_1.INJ_CAUSE AND
    IJNT_DESC.TBL_CD (+) = CLAIM_1.NATR AND
    IJPB_DESC.TBL_CD (+) = CLAIM_1.PART_OF_BODY ;

  • How do you write sideways in Pages?????

    How do you write sideways in pages w/ the page upright?

    This awesome tip solved my issue; it works with graphics, too. Thanks very much!!!!!!!
    Create a text box, type what you want in it, then
    rotate it using the Inspector (Select the text box,
    go to the "metrics" tab of the inspector, and rotate
    it with the little wheel).

  • How do you know what classes to use ?

    Hello,
    This may sound daft - but how do you know what classes to use to do a particular task ? For example to do password-related stuff - how would I know which classes are all relevant to that ? Am I supposed to buy a book on the classes as the API documentation doesn't really tell you WHEN to use which classes.

    If you're using JSP, then your password field is likely going to be implemented in HTML. So that's nothing to do with Java. (And you can't use a JPassword field in a JSP page.) But when that field comes back to your server, you may be using Java to authenticate it. Even there, the question is not yet what Java method you are going to use, but what methodology. You could have a database to authenticate against, or an LDAP directory. Or you could have the web server use its built-in authentication, which means you don't have to do any Java coding at all. And there are other ways.
    So the question before yours is, how do you know what methodology to use? Again, that comes down to experience.

  • How do you write on the documents useing using work space

    how do you write on the documents using work space

    What type of documents are you trying to write on?

  • How do you write UNDO for a text item?? examples? or a REDO??

    How do you write UNDO for a text item?? examples? or a REDO??
    I created a pop-up menu with CUT, COPY, PASTE, UNDO, CLEAR for my text items.
    Using MAGIC menu type works great but there is no MAGIC for UNDO or REDO.....
    How do you write UNDO for a text item?? examples? or a REDO??
    I have Oracle Forms 6i...
    Lets say I highlight all the text in the text item, and start typing over it... then I realize OH NO it is the wrong text field...
    Now I want to UNDO the typing and get back to the previous text.
    I'd use the initial value that was populate right? How do I access that if that is correct?
    Thanks, Bill

    You can use;
    <ITEM> := Get_Item_Property(<ITEM>,DATABASE_VALUE);
    Or you will have to write a pre-text-item trigger;
    PRE-TEXT-ITEM:
    :CTRL.CURRENT_VAL := :<BLOCK>.<ITEM>
    MENU (PL/SQL):
    :<BLOCK>.<ITEM> := :CTRL.CURRENT_VAL;
    You may also want to set the item property back to ITEM_IS_VALID so that item validation does not fire again.

  • Content Holder How do you get css class to appear in the wysiwyg editor? The only option is "clear class".

    Need an answer to my question: How do you get css class to appear in the wysiwyg editor? The only option is "clear class".

    Liam,
    If it's not supported there, then where can I access the css and do you have any recommendations for a simple app to change the css style?

  • How do you disable the "Touch to return to call" banner on the top of the screen?

    How do you disable the "Touch to return to call" banner on an iPhone 4s and it is factory unlocked?
    Thank you.

    If your trying to just simply have it not show while navigating the OS during a call, then there is no option to disable it. If it's a problem where it's continuing to show after you disconnect a call it could be a fault in code that fails to run the script to terminate the banner need upon disconnect. I would restore the phone using itunes as a first troubleshooting step. Another avenue might be an issue with the phone failing to recognize the end of call signal from the carrier. In which case I would have the SIM card changed. Easy thing to do at your local carrier store.

  • How do you write ?

    hi all,
    what is your preferred way to handle statements exceptions:
    try {
      Statement stm = conn.createStatement();
      try {
        // execute statements
        conn.commit();
      } catch (SQLException sqle) {
        // handle error
        conn.rollback();
      } finally {
        stm.close();
    } catch (SQLException sqle) {
      // handle error again ?
    }or ...
    Statement stm = null;
    try {
      stm = conn.createStatement();
      // execute statements
      conn.commit();
    } catch (SQLException sqle) {
      // handle error
      try {conn.rollback();}catch(SQLException sqle){/*nothing here ?*/}
    } finally {
      if (stm!=null)
        try {stm.close();}catch(SQLException sqle){/*nothing here ?*/}
    }or something else ? ...
    thanks

    Miksi tämä sähköpostiviesti on tullut minun osoitteeseen?   Eikä tämä ole ensimmäinen kerta kun minulle tulee väärin postia.   Miltä tämä sinusta tuntuu?
          Terv. Seppo
    Date: Thu, 22 Jul 2010 10:27:47 -0600
    From: [email protected]
    To: [email protected]
    Subject: Re: how do you write
    Hi Sandy,
    Acrobat Pro 9 is an excellent tool for creating and distributing forms; however, if a form was created in Acrobat and enabled for completion, you should be able to fill it out using Adobe Reader. As not all forms are enabled in this way, you won't be able to complete all forms digitally. For more information about Acrobat Pro, please refer to the product information page:
    http://www.adobe.com/products/acrobatpro/
    If you're using Windows, you can also download a free 30-day trial of Acrobat from right here:
    http://www.adobe.com/products/acrobatpro/tryout.html
    (Unfortunately, there is no Mac trial available at this time).
    I also encourage you to stay tuned to changes taking place at Acrobat.com over the next several months; you may find that they'll be interesting to you.
    Best regards,
    Rebecca
    >

  • How can I write new objects to the existing file with already written objec

    Hi,
    I've got a problem in my app.
    Namely, my app stores data as objects written to the files. Everything is OK, when I write some data (objects of a class defined by me) to the file (by using writeObject method from ObjectOutputStream) and then I'm reading it sequencially by the corresponding readObject method (from ObjectInputStream).
    Problems start when I add new objects to the already existing file (to the end of this file). Then, when I'm trying to read newly written data, I get an exception:
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    Is there any method to avoid corrupting the stream? Maybe it is a silly problem, but I really can't cope with it! How can I write new objects to the existing file with already written objects?
    If anyone of you know something about this issue, please help!
    Jai

    Here is a piece of sample codes. You can save the bytes read from the object by invoking save(byte[] b), and load the last inserted object by invoking load.
    * Created on 2004-12-23
    package com.cpic.msgbus.monitor.util.cachequeue;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    * @author elgs This is a very high performance implemention of Cache.
    public class StackCache implements Cache
        protected long             seed    = 0;
        protected RandomAccessFile raf;
        protected int              count;
        protected String           cacheDeviceName;
        protected Adapter          adapter;
        protected long             pointer = 0;
        protected File             f;
        public StackCache(String name) throws IOException
            cacheDeviceName = name;
            f = new File(Const.cacheHome + name);
            raf = new RandomAccessFile(f, "rw");
            if (raf.length() == 0)
                raf.writeLong(0L);
         * Whne the cache file is getting large in size and may there be fragments,
         * we should do a shrink.
        public synchronized void shrink() throws IOException
            int BUF = 8192;
            long pointer = getPointer();
            long size = pointer + 4;
            File temp = new File(Const.cacheHome + getCacheDeviceName() + ".shrink");
            FileInputStream in = new FileInputStream(f);
            FileOutputStream out = new FileOutputStream(temp);
            byte[] buf = new byte[BUF];
            long runs = size / BUF;
            int mode = (int) size % BUF;
            for (long l = 0; l < runs; ++l)
                in.read(buf);
                out.write(buf);
            in.read(buf, 0, mode);
            out.write(buf, 0, mode);
            out.flush();
            out.close();
            in.close();
            raf.close();
            f.delete();
            temp.renameTo(f);
            raf = new RandomAccessFile(f, "rw");
        private synchronized long getPointer() throws IOException
            long l = raf.getFilePointer();
            raf.seek(0);
            long pointer = raf.readLong();
            raf.seek(l);
            return pointer < 8 ? 4 : pointer;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#load()
        public synchronized byte[] load() throws IOException
            pointer = getPointer();
            if (pointer < 8)
                return null;
            raf.seek(pointer);
            int length = raf.readInt();
            pointer = pointer - length - 4;
            raf.seek(0);
            raf.writeLong(pointer);
            byte[] b = new byte[length];
            raf.seek(pointer + 4);
            raf.read(b);
            --count;
            return b;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#save(byte[])
        public synchronized void save(byte[] b) throws IOException
            pointer = getPointer();
            int length = b.length;
            pointer += 4;
            raf.seek(pointer);
            raf.write(b);
            raf.writeInt(length);
            pointer = raf.getFilePointer() - 4;
            raf.seek(0);
            raf.writeLong(pointer);
            ++count;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCachedObjectsCount()
        public synchronized int getCachedObjectsCount()
            return count;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCacheDeviceName()
        public String getCacheDeviceName()
            return cacheDeviceName;
    }

  • How do you know the version of a JAR file ?

    how do you know the version of a JAR file ?
    is it what is written on MANIFEST.MF ?
    for example i have a JAR file
    whose MANIFEST.MF has this
    Manifest-Version: 1.0
    Created-By: Ant 1.4.1so, whats the version of this JAR ? 1.0 ?

    anyway, that was JSTL..jar.
    Now, come to another JAR file....
    whose MANIFEST.MF has......
    Manifest-Version: 1.0
    Created-By: Apache Ant 1.5.1
    Extension-Name: Struts Framework
    Specification-Title: Struts Framework
    Specification-Vendor: Apache Software Foundation
    Specification-Version: 1.1
    Implementation-Title: Struts Framework
    Implementation-Vendor: Apache Software Foundation
    Implementation-Vendor-Id: org.apache
    Implementation-Version: 1.1
    Class-Path:  commons-beanutils.jar commons-collections.jar commons-dig
    ester.jar commons-logging.jar commons-validator.jar jakarta-oro.jar s
    truts-legacy.jarso, How do you believe whats the version now ? do u go with the comment "Manifest-Version: 1.0" or "Specification-Version: 1.1" ?
    definitely, you would go with the "Specification-Version: 1.1" and declare this JAR as STRUTS 1.1
    hmmm, so, if nothing is mentioned like above should we follow the MANIFEST version as the JSTL version ? in my earlier example i did not find any comment on ""Specification-Version" ......so , if anybody gives me that JAR , how do i decide whether its 1.0 specification or 1.1 specifucation compliant ?
    can you tell whats the JSTL version of my earler example JAR file ?

  • How to allow write privileges by a process to files?

    Hi there
    In SPARC-Solaris8:
    How to allow write privileges by a process to files?
    Tks in advance,
    C�sar

    The access to files will be controlled by the owner of the files, the owner of the process trying to access the files and the permissions set on the files.
    You can use either user, group or world permissions to limit access to files by processes owned by different users.
    For example, a files with permissions of 777 (rwxrwxrwx) could be written to by every user on the system. A files with 760 (rwxrw----) could be written to by anyone who owned it, or anyone in the same group, but not have general write permissions.
    read man pages on group, chmod, etc to get an understanding of how the permissions and the owner of a process interact.

  • How do I write a command in a .batch file written in NOTEPAD to run a powershell command?

    How do I write a command in a .batch file written in NOTEPAD to run a powershell command?
    Example:
    powershell -Command "& {Update-Help;}"
    would this be a correct command to put in a .batch file to update help information in powershell.
    All I want to know is how to write a windows powershell command in a .batch file.
    Multi-Commands
    Single-Commands
    Charles Wright

    Hi,
    You can separate multiple commands with a semicolon (;).
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • New user...how do you drag or move or copy a file or folder from the desktop to an external drive?  I have tried dragging and copy/pasting.

    new user...how do you drag or move or copy a file or folder from the desktop to an external drive?  I have tried dragging and copy/pasting.

    My guess the problem you are running into is the drive is formatted for a PC as NTFS. OS X can read files from NTFS however it cannot write to it. Check the formatting on the drive, if it's NTFS then it should be reformatted to Mac OS Extended (Journaled), you can use Disk Utility to do this.
    If you still have a PC and want to share the EHD with the PC and Mac please read MacWorld's Share an external drive between a Mac and a PC article.

Maybe you are looking for

  • Adobe Captivate 5 published as pdf not displaying in certain versions of Adobe Acrobat and Reader

    We have an issue where upon publishing files as a pdf in Adobe Captivate 5, they will not open in Adobe Acrobat Pro (9 or 10) or Adobe Reader (11).  However, they will open in Adobe Reader 10.1.4.  I have searched up and down these forums and google,

  • Sync settings with office computer

    I just upgraded my blackberry and noticed that messages I sent from my office computer are not appearing in the list of email messages on my blackberry.  The only sent items are those sent from the Blackberry.  Is there a setting that I need to tweak

  • Landing Page for Users in OBIEE

    Hi, I am new to the OBIEE Tool and working on OBIEE 10g. I have got a requirment where , when the Client Logs in, they will see a Landing Page which will contain summary(it can be a Snap Shot) of different Dashboards, some User Documents along with I

  • Real Problems With White Balance Tool

    I attempted to white balance an image I took using the White Balance eyedropper tool, and selecing an area on a Grey Balance Target. Well, Aperture is doing a horrible job of white balancing the image. With Aperture, I exported the image to Photoshop

  • Next Chapter jump

    I'm finishing off a project in which I have a number of audio tracks set to still images. I had originally positioned Chapter Markers at the end of each, so you could jump back to the menu by selecting Next Chapter - but when building the project, th