About delete file

a file has password in it,when I delete the file,first I use objInput.readObject() and get the password;
then compare the inputed password by user; but when password is correct,delete the file is not able;
this file is using;the upon objInput.readObject() let this file is using;
this problem how to solve?

close
public void close()
           throws IOExceptionCloses the input stream. Must be called to release any resources associated with the stream.
Specified by:
close in interface ObjectInput
Overrides:
close in class InputStream
Throws:
IOException - If an I/O error has occurred.
Sample code for Reading a File
public void inputFile(String fileName)  throws IOException,ClassNotFoundException
        File inFile = new File(fileName);   //Instantiate File Class
        FileInputStream inStream = new FileInputStream(inFile); // FileInputStream
            ObjectInputStream itemsIn = new ObjectInputStream(inStream); //ObjectInputStream
           // Assign the properties to the instance of the Object
            this.numItems = itemsIn.readInt(); // Read numItems property and assign to
            this.inventory = (Item []) itemsIn.readObject(); // Read Items into array - notice the casting
            itemsIn.close();  //close File
      }//End readFromfile

Similar Messages

  • I want to ask about deleting files that have been deleted in the trash but I want to remove it permanently from the trash can not

    I want to ask about deleting files that have been deleted in the trash but I want to remove it permanently from the trash can not, indeed I delete files that are partly contained in the application file. I want to delete files that are also quite a lot by 5 Gyga, I've tried to remove it from the normal trash remains are not removed. How should I do?

    +

  • Question about delete file

    The aim is simple, first make a copy of specified file, then delete the old file.
    I use FileInputStream and FileOutputStream to do the copy job.
         FileInputStream fis = new FileInputStream(oldFile);
         FileOutputStream fos = new FileOutputStream(newFile);
         // do copy
    After close these 2 stream, do delete.
    like:
         fis.close();
         fos.close();
         oldFile.delete();
    Here I have a trouble. Sometimes I cannot delete the file successfully(no one else is opening it), I have to call garbage collector first.
    like:
         fis.close();
         fos.close();
         fis = null;
         fos = null;
         System.gc();
         oldFile.delete();
    Isn't the stream's connection to the file on disk already been closed by 'fis.close()'?
    Who can tell me why? Thanks.
    Environment: Tomcat 5.0, JDK 1.4

    'move the file' , you mean 'renameTo(File) '?Yes, that's what I meant.
    If a simple delete operation failed, how can I
    suppose the move operation will be succeed?I haven't tried it and haven't got a specific expectation either way. If you don't think it's worth trying, don't.
    I just hope that it will work correctly after a call
    of GC.I'll keep my fingers crossed for you :-)

  • Help needed about deleting files.

    Anyone could tell me what Java sentence can I use to delete a file from a UNIX filesystem. What class does provide this method?

    Hi,
    The File class has got method to delete a file from file system.
    File objFile = new File("<the complete path of the file>");
    if(objFile.exists()) { objFile.delete(); }
    Only extra thing with unix will be permission to delete
    the file. If the user who is logged into the system with
    permission to delete the file then only the java
    program which is run under that user id will be able
    to delete the file. Otherwise change the mode of that
    directory to '777'.
    chmod 777 /home/temp

  • An bug about deleted files.

    i have noticed that in osX 10.5.6, finder don't remove from "recent folders" menù folders that have been deleted.
    i noticed also that if you click on an item that links to an deleted folders, finder try to open that folder and will crash when you click on "back" button.
    in fact, if you follow theese steps, finder will reopen (i think it crash).
    1. create an folder.
    2. open that folder.
    3. move that folder to trash, then empty trash.
    4. in finder, go to the recent folders menù.
    5. click on item that refers to the folder you have deleted.
    6. finder will open an empty window with "back" button enabled, so click on "back" button.

    Can't help with the problem, but if you want to report this to Apple, either send Feedback or send bug reports and enhancement requests via its Bug Reporter system. To do the latter, join the Apple Developer Connection (ADC)—it's free and available for all Mac users and gets you a look at some development software. Since you already have an Apple username/ID, use that. Once a member, go to Apple BugReporter and file your bug report/enhancement request. The nice thing with this procedure over submitting feedback is that you get a response and a follow-up number; thus, starting a dialog with engineering.

  • How do i go about deleting a large number of files at the same time?  where's the easiest place to do it?

    how do i go about deleting a large number of files at the same time?  where's the easiest place to do it?

    A bit vague as to what you intend, but the simple answer is to select all the files you want to delete then either drag to the Trash or CTRL- or RIGHT-click on the selection and choose Move to Trash from the contextual menu.

  • How do I go about deleting mulitple song files all at one time as opposed to deleting them all individually off of the latest version of iTunes

    How do I go about deleting mulitple song files all at one time as opposed to deleting them all individually off of the latest version of iTunes?
    Also I have tried authorizing my computer to play the songs I purchased off of iTunes when I had an iPhone 4 and it will not allow me to play them whatsoever. I now have an iPhone 5 and wish to load these past song purchases onto my new phone. How do I solve this issue?

    what you're missing to export multiple files is the batch export command available in the file menu or by control clicking on the items in the browser.  You can export multiple sequences/clips at full resolution with this.
    This has been available in fcp for a long long time.
    Wow, you are right.  Now that you mention it, I can't believe I never noticed that.  Thanks.
    Only if you have the 'Self-Contained' box checked.  Otherwise you'll end up with a reference movie.
    Correct.  That box is typically checked by default.  There are other default settings you could change that would not result in a full-quality version, but what I meant was hitting that option from the pull-down menu, then changing nothing and hitting ok.

  • My 5 year old MacBook Air is telling me it "cannot save information about your mailboxes because there isn't enough space in your home folder.  Quit mail, delete files you don't need, then reopen mail."  What is "home folder," and which files to delete?

    My 5 year old MacBook Air is telling me it "cannot save information about your mailboxes because there isn't enough space in your home folder.  Quit mail, delete files you don't need, then reopen mail."  What is "home folder," and which files to delete? Thanks.

    The home folder is where all of your personal files are kept.
    Best candidates to delete are movies, videos, music and photos since they generally take the most space.
    Don't forget to empry the Trash after you delete the file because the space is not returned until the Trash is emptied.
    Allan

  • Idisk app: delete file from iphone but NOT idisk?

    maybe i'm missing something but how do you delete a downloaded file from just your iphone? when i tap the delete button in the downloaded file window it deletes it from my idisk.

    Jeff Stone1 wrote:
    well that is sort of what i thought. when the app was originally previewed it was stated that you can VIEW your documents stored on your idisk. but the mobileme page on the apple site says that you can DOWNLOAD files to your iphone.
    i just looked and i only see where you can view and share files but i don't see anything about downloading files.
    on a side note why is the icon blue didn't it change from blue to a pink with the change from .mac to mobile me.

  • TS4009 How do I clean up mail in my icloud?  I have already deleted old mail on all devices, and emptied the junk & deleted files, but it still shows that I am at max on my icloud. What do I do to free up space? (photos & apps do not take up that much roo

    How do I clean up mail in my icloud?  I have already deleted old mail (from all my e-mail accounts) on all devices, and emptied the junk & deleted files, but it still shows that I am at max on my icloud. What do I do to free up space? (photos & apps do not take up that much room).  When I go to manage storage on any device & it will display how much room each program or app is using, it still shows that my e-mail is taking up the most room.  Is there a way to actually log on to the icloud server to manage what it stored there?  If so, how do I do it?  Also, on a related subject,  why does my mail not sync accross all devices?   ie. when I delete an email on one device, why do I still see it on all my other devices?  How can I change this?
    I have an iphone5, ipad2, ipod 4th gen, ipod 3rd gen, all running on my same apple id - but I have a PC not a Mac home computer - is this part of the problem?  Looking to upgrade to a Mac sometime this year...
    Thank-you for the help!

    beckyfromoz wrote:
    I do have the Time Capsule and spoke to Apple Care here in Sydney about it yesterday.  They told me my mail is not backed up there unless I create a special folder. I just tried ringing them again but Apple Care is closed today...
    Mail is backed up automatically. If you make backups automatically, open Mail application and then, open the Time Machine app (in /Applications/Utilities). You will access to the Time Machine interface, and you will be able to see all your mails of all the backups you have, and you will be able to restore them. It means that your mails are backed up onto the Time Capsule

  • Can not delete files from Adobe reader

    can not delete files from adobe reader.

    Can you let us know a little more about what you are trying to do? Adobe Reader opens pdf files but does not store them so, there's nothing to delete.

  • How to recover Deleted file from HARD DISK

    By mistake my entire AVCHD file of 90 Mts  duration was deleted from my Hard Disk, this  I realised after a week., in the meantime I have not added or deleted any file from this hard Disk. I had given my this hard disk to my service engineer to recover the video., he has tried and recover some 40 mb file., but I cant open this recovered video file in Premiere or any other video convertor programme., also I cant get any information about Video.
    Can anybody in the forum help me and suggest how to recover my deleted Video from the Hard disk

    Hi, hard disk data loss is actually a hard task for many users 'cause most of them think this kind of problems is a complicated situation. Here are some tips you need to know after data loss happened.
    1. If you meet the file loss situation, keep calm and stop using your computer to do any read or write operation until you find the way to recover the lost files because any wrong operation.
    2. If you've lost a file, time is of the essence. As new files saved to Mac hard drive or storage devices, the original files gets overwritten. So do not use the drive or disk which your deleted files are stored before at all, until you have completed the scanning and recovery process.
    3. The system crashed or the files loss situation happens occasionally, so remember build a backup for the files periodically is strongly needed.
    4. If you meet the file loss situation again, stop using the Mac or storage device right now, use another computer to process the files recovery.
    5. Remember this, no matter at the normal time or after files recovery, build a backup for the files periodically is the best method to protect your files from data loss situation.
    This post offers you more tips you may need: http://www.uflysoft.com/data-recovery-mac/mac-files-recovery.html

  • Cannot delete file ...bug?

    This appears like a bug to me...see if you agree.
    A file opened for read-only access and memory mapped using the map method of FileChannel cannot be deleted even when the channel is closed. An example of this is the simple Grep.java example from NIO modified only to try and delete the file. On Win2K, the delete fails. Once the channel is closed, it should be able to delete the file. Is this a bug?
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.*;
    import java.nio.charset.*;
    import java.util.regex.*; public class Grep {     // Charset and decoder for ISO-8859-15
    private static Charset charset = Charset.forName("ISO-8859-15");
    private static CharsetDecoder decoder = charset.newDecoder(); // Pattern used to parse lines
    private static Pattern linePattern
    = Pattern.compile(".*\r?\n"); // The input pattern that we're looking for
    private static Pattern pattern; // Compile the pattern from the command line
    private static void compile(String pat) {
    try {
    pattern = Pattern.compile(pat);
    } catch (PatternSyntaxException x) {
    System.err.println(x.getMessage());
    System.exit(1);
    } // Use the linePattern to break the given CharBuffer into lines, applying
    // the input pattern to each line to see if we have a match
    private static void grep(File f, CharBuffer cb) {
    Matcher lm = linePattern.matcher(cb);// Line matcher
    Matcher pm = null;// Pattern matcher
    int lines = 0;
    while (lm.find()) {
    lines++;
    CharSequence cs = lm.group(); // The current line
    if (pm == null)
    pm = pattern.matcher(cs);
    else
    pm.reset(cs);
    if (pm.find())
    System.out.print(f + ":" + lines + ":" + cs);
    if (lm.end() == cb.limit())
    break;
    } // Search for occurrences of the input pattern in the given file
    private static void grep(File f) throws IOException { // Open the file and then get a channel from the stream
    FileInputStream fis = new FileInputStream(f);
    FileChannel fc = fis.getChannel(); // Get the file's size and then map it into memory
    int sz = (int)fc.size();
    MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz); // Decode the file into a char buffer
    CharBuffer cb = decoder.decode(bb); // Perform the search
    grep(f, cb); // Close the channel and the stream
    fc.close();
    // Try deleting the file =================================
    boolean deleted = f.delete();
    if (!(deleted)) {
    System.err.println("Could not delete file " + f.getName());
    System.exit(4);
    // End try deleting file =================================
    } public static void main(String[] args) {
    if (args.length < 2) {
    System.err.println("Usage: java Grep pattern file...");
    return;
    compile(args[0]);
    for (int i = 1; i < args.length; i++) {
    File f = new File(args);
    try {
    grep(f);
    } catch (IOException x) {
    System.err.println(f + ": " + x);

    Here is the minimal code that demonstrates this. It opens the file specified on the command line, maps it to memory, prints it out, and then tries to delete the file.
    There is no question about calling close on a File object. The close method is invoked on a stream or a channel. In the case of a channel, it should automatically close the stream. However, in this code I am closing the stream and the channel.
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.*;
    import java.nio.charset.*;
    public class testFileDelete {
    public static void main(String[] args) {
              FileInputStream fis = null;
              if (args.length < 1) {
                   System.err.println("Usage: java testFileDelete <filename>");
                   System.exit(1);
              File f = new File(args[0]);
    try {
                   // Open the file
                   fis = new FileInputStream(f);
              } catch (FileNotFoundException ex) {
                   System.err.println("Error! " + ex.getMessage());
                   System.exit(2);
              try {
                   // Get a channel from the stream
                   FileChannel fc = fis.getChannel();
                   // Map the file into memory
                   MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, (int)fc.size());
                   // Do something interesting here. For this example, just print the
                   // contents of the file.
                   // Decode the file into a char buffer, so we can print the contents.
                   Charset cs = Charset.forName("8859_1");
                   CharsetDecoder cd = cs.newDecoder();
                   CharBuffer cb = cd.decode(bb);
                   // Now print it out to standard output
              System.out.print(cb);
                   // Close the channel and the stream
                   fc.close();
                   // Close the input stream even though closing the
                   // channel should do this
                   fis.close();
              } catch (IOException ex) {
                   System.err.println("Error! " + ex.getMessage());
                   System.exit(3);
              // Done processing file. Now delete it.
              boolean deleted = f.delete();
              if (!(deleted)) {
                   System.err.println("Could not delete file " + f.getName());
                   System.exit(2);

  • Delete file out folder

    I have a drop folder that duplicates it content to another folder
    How would I go about deleting or purging the contents in the drop folder once has transfered?
    Thanks!

    If there is a problem with your move statement, removing the try statement will show the error (you are suppressing error messages). I am testing with the following script, which appears to work for me:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #B5FF6C;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    property choiceTitles : {¬
    "User 1", ¬
    "User 2", ¬
    "User 3"}
    property chosenRecipients : {¬
    {"User1 <[email protected]>", "User3 <User3@User3>"}, ¬
    {"User2 <User2@sUser2>", "User3 <User3@sUser3>"}, ¬
    "User3 <User3@User3>"}
    property theSender : "MyEmail <[email protected]>"
    property messageText : " type body copy here "
    property commonName : "Files"
    on run -- application double-clicked or run from the Script Editor
    doStuff for (choose file with multiple selections allowed)
    end run
    on open theFiles -- items dropped onto the application
    doStuff for theFiles
    end open
    on adding folder items to someFolder after receiving addedItems -- folder action
    doStuff for addedItems
    end adding folder items to
    to doStuff for someFiles
    create a new Mail message for each file in someFiles
    parameters - someFiles [list]: a list of files to do stuff with
    returns nothing
    try
    repeat with anItem in someFiles
    set recipientAddress to (matchChoice from choiceTitles into chosenRecipients)
    if the result is false then error number -128 -- cancel
    tell application "Finder" to set theSubject to the name of anItem
    tell application "Mail"
    set newmessage to make new outgoing message with properties {content:(messageText & return & return)}
    tell newmessage
    set visible to true
    set sender to theSender
    set subject to theSubject
    -- make new attachment with properties {file name:anItem} at after the last paragraph
    repeat with someRecipient in recipientAddress -- handle multiple recipients
    if class of someRecipient is list then -- handle recipient sub lists
    repeat with aRecipient in someRecipient
    make new to recipient at end of to recipients with properties {name:commonName, address:aRecipient}
    end repeat
    else
    make new to recipient at end of to recipients with properties {name:commonName, address:someRecipient}
    end if
    end repeat
    end tell
    -- send newMessage
    end tell
    end repeat
    tell application "Finder" to move someFiles to (path to desktop)
    on error errorMessage number errorNumber -- oops
    log errorMessage
    -- display alert "Error " & errorNumber message errorMessage
    end try
    end doStuff
    to matchChoice from sourceList into objectList
    displays a dialog using the sourceList, then matches the item(s) chosen with the same item(s) in the objectList
    if there are duplicate items in the sourceList, only the first matching item from the objectList is used
    parameters - sourceList [list]: a list of text items to choose from
    objectList [list]: a list of objects
    returns [list]: a list of the chosen objects, or false if error/cancel
    set chosenItems to {}
    try
    if (count sourceList) is greater than (count objectList) then error "matchChoice: sourceList is larger than objectList"
    set theChoices to choose from list sourceList with multiple selections allowed
    if the result is false then error "matchChoice : dialog cancelled" -- cancel
    repeat with anItem in theChoices
    set anItem to the contents of anItem
    repeat with theIndex from 1 to (count of sourceList)
    if the contents of (item theIndex of sourceList) is anItem then
    set the end of chosenItems to item theIndex of objectList
    exit repeat
    end if
    end repeat
    end repeat
    on error errorMessage
    log errorMessage
    -- error errorMessage -- pass it on
    return false
    end try
    return chosenItems
    end matchChoice
    </pre>

  • Cannot delete file SAP0000.TSK.bck

    hi
       I am installing ECC5.0 ides on windows 2000.
        I have finished intalling central instance but when doing database instance i am getting following error
    This is a trace of SAP0000.log file
    DbSl Trace: ORA-1403 when accessing table SAPUSER
    (DB) INFO: connected to DB
    (DB) INFO: DbSlControl(DBSL_CMD_NLS_CHARACTERSET_GET): WE8DEC
    (TSK) ERROR: file C:\Program Files\sapinst_instdir\ECC_50_ABAP_NUC\DB/SAP0000.TSK.bck already seems to exist
                 a previous run may not have been finished cleanly
                 file C:\Program Files\sapinst_instdir\ECC_50_ABAP_NUC\DB/SAP0000.TSK possibly corrupted
    D:\usr\sap\IDS\SYS\exe\run/R3load.exe: job finished with 1 error(s)
    D:\usr\sap\IDS\SYS\exe\run/R3load.exe: END OF LOG: 20071112112456
    Now as you can see here it is saying about SAP0000.TSK possibly corrupted .Considering this line i have one more trace in SAP0000.log file just before this which says that
    DbSl Trace: ORA-1403 when accessing table SAPUSER
    (DB) INFO: connected to DB
    (DB) INFO: DbSlControl(DBSL_CMD_NLS_CHARACTERSET_GET): WE8DEC
    (TSK) ERROR: couldn't delete file C:\Program Files\sapinst_instdir\ECC_50_ABAP_NUC\DB/SAP0000.TSK.bck
    (TSK) ERROR: OS error message: Permission denied
    (DB) INFO: disconnected from DB
    D:\usr\sap\IDS\SYS\exe\run/R3load.exe: job finished with 1 error(s)
    D:\usr\sap\IDS\SYS\exe\run/R3load.exe: END OF LOG: 20071112044011
    Can nebody guide me on this ....
    regards
    Siddharth

    Hi sunil
       Thanks for replying ...
       I have resolved that problem by deleting the file manually with adminsitrator account and at the same time i have copied SAP0000.TSK file from another sap installation .The installation is thru with the error i mentioned in the post.
       But now there is one more error . I m copying extract of SAPVIEW.log file
    error message returned by DbSl:
    ORA-00942: table or view does not exist
    (IMP) INFO: a failed DROP attempt is not necessarily a problem
    (DB) ERROR: DDL statement failed
    (CREATE VIEW "D010LINF" ( "PROG" , "R3STATE" , "MACH" , "UNAM" , "UDAT" , "UTIME" , "L_DATALG" , "Q_DATALG" , "SDAT" , "STIME" , "MINOR_VERS" , "MAJOR_VERS"  ) AS SELECT T0001."PROGNAME", T0001."R3STATE", T0001."MACH", T0001."UNAM", T0001."UDAT",  T0001."UTIME", T0001."L_DATALG", T0001."Q_DATALG", T0001."SDAT", T0001."STIME", T0001."MINOR_VERS", T0001."MAJOR_VERS" FROM "REPOLOAD" T0001)
    DbSlExecute: rc = 103
      (SQL error 942)
    Please suggest ...
    regards
    siddharth

Maybe you are looking for

  • Why wont my iphone 4s sync up to vista

    im really having a horrible time strating to sync my new 4s up to vista, i have reinstalled and gone through the process that was given to me by itunes and they finally suggested replacing the phone. Once i hooked it up to windows 7 no prob but both

  • HP C8180 Printing Problem

    I have a HP C8180 that when printing a photo on photo paper (8.5x11)  using the standard paper quality setting it prints a great photo but when any photo paper quality is selected, it wants to print a pinkish orange tint.  When printing to 4x6 it pri

  • HP Officejet and Deskjet Printers NOW ADDED to "not yet supported" list

    Before today (9/4/09) my printer was listed here: http://h10025.www1.hp.com/ewfrf/wc/document?docname=c01846935&lc=en&dlc=en&cc=us &product=441125&os=219&lang=en As being supported (HP Officejet 5600 Series). However, the driver is NOT available from

  • Firefox 3.6.8 will not print.

    Firefox 3.6.8 will not print my AOL mail or any web page. It says a printer needs to be installed. I believe this began happening when I upgraded from Firefox 3.6.6. == This happened == Every time Firefox opened == When I upgraded from Firefox 3.6.6

  • Sync Java Proxy Server response in XML

    Hi ! We've this scenario: File1 <-> XI <-> Java Proxy <-> File2 Using a BPM, we made a Async/Sync workflow. It works ok. It uses a SYNC Java Proxy Server. The problem is that inside the java proxy, we query an http source that returns already XML for