CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2011
    Posts
    197

    [RESOLVED] Tutorial Questoin(ENUM'S)

    How can I use these? Do I need to import a certain package or what?
    Code:
     
    •WRITE – Opens the file for write access.
    •APPEND – Appends the new data to the end of the file. This option is used with the WRITE or CREATE options.
    •TRUNCATE_EXISTING – Truncates the file to zero bytes. This option is used with the WRITE option.
    •CREATE_NEW – Creates a new file and throws an exception if the file already exists.
    •CREATE – Opens the file if it exists or creates a new file if it does not.
    •DELETE_ON_CLOSE – Deletes the file when the stream is closed. This option is useful for temporary files.
    •SPARSE – Hints that a newly created file will be sparse. This advanced option is honored on some file systems, such as NTFS, where large files with data "gaps" can be stored in a more efficient manner where those empty gaps do not consume disk space.
    •SYNC – Keeps the file (both content and metadata) synchronized with the underlying storage device.
    •DSYNC – Keeps the file content synchronized with the underlying storage device.
    
    --------------------------------------------------------------------------------
    I get this error:
    Code:
     Test.java:36: error: cannot find symbol
         try(FileChannel f7 =  (FileChannel.open("Test2.txt", READ, WRITE))) {
                                                              ^
      symbol:   variable READ
      location: class Test
    Test.java:36: error: cannot find symbol
         try(FileChannel f7 =  (FileChannel.open("Test2.txt", READ, WRITE))) {
                                                                    ^
      symbol:   variable WRITE
      location: class Test

    With this:

    Code:
     try(FileChannel f7 =  (FileChannel.open("Test2.txt", READ, WRITE))) {
    Last edited by kolt007; October 5th, 2011 at 09:25 PM.

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: Tutorial Questoin(ENUM'S)

    These appear to be from the java.nio.file.StandardOpenOption enum, so you will need to include that class.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured