writing to random access file with specific encoding


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: writing to random access file with specific encoding

  1. #1
    Join Date
    Jun 2005
    Posts
    3

    writing to random access file with specific encoding

    Hi
    i am trying to write in a random access file some records
    the name of the file is typed by the user in a specific field

    file = new RandomAccessFile((name.getText() + ".txt"), "rw");

    after i finish with the records of the file
    i close the file

    then i reopen the same file in order to manipulate some data
    and i observed that the reason i cannot manipulate the data
    is because the file is stored with the Unicode(big endian) encoding
    and not with the ANSI ecoding

    any help?
    i would be very greatful
    thanks

  2. #2
    Join Date
    Aug 2003
    Posts
    313
    What type of data are you storing in the file? Characters in Java should be written and read the same way so if you are generating the file and reading it in Java then you shouldn't have a problem. If you are talking about a binary file, then I would recommend using a class for that such as DataInputStream. Whichever way you go, just make sure that the reading and writing classes are making the same assumptions about the file.

    I'm not sure if I answered you question, but I hope this helps.
    ~evlich

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center