commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From commons-...@jakarta.apache.org
Subject [Jakarta Commons Wiki] New: Transaction
Date Tue, 15 Feb 2005 16:13:02 GMT
   Date: 2005-02-15T08:13:02
   Editor: RajThangaraj
   Wiki: Jakarta Commons Wiki
   Page: Transaction
   URL: http://wiki.apache.org/jakarta-commons/Transaction

   Name of the output file in file transaction

New Page:

I wrote the following code to create temp.txt in the stored directory
But some file with a diff name(aW5kZXgxLnR4dA%3D%3D) gets created. Does someone know how to
specify the name of the output file

        Logger logger = Logger.getLogger("d:\\Raj\\test.log");
        LoggerFacade loggerFacade = new Log4jLogger(logger);
        FileResourceManager fileResourceManager = 
               new FileResourceManager("D:\\Raj\\stored", "D:\\Raj\\working", true, loggerFacade
);
        fileResourceManager.start();
        String txId = fileResourceManager.generatedUniqueTxId();
        System.out.println("Working Directory : " + fileResourceManager.getWorkDir());
        System.out.println("Store Directory : " + fileResourceManager.getStoreDir());
        System.out.println("Transaction Identifier : " + txId);
        fileResourceManager.startTransaction(txId);
        FileInputStream fis = new FileInputStream("D:\\Raj\\stored\\index.txt");
        byte[] bt1 = new byte[100];
        fis.read(bt1);
        fis.close();
        OutputStream os = fileResourceManager.writeResource(txId, "temp.txt");
        os.write(bt1);
        fileResourceManager.commitTransaction(txId);

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message