Results 1 to 2 of 2
  1. #1
    GraemeH is offline Member
    Join Date
    Mar 2009
    Rep Power

    Default Problem Saving a file

    Hello everyone,

    Bit of a bizzare question here. I'm reading different files (.dat, .props, .txt) into my application. I've got that working fine. I'm now trying to save the output. I've got it working fine for all the types of file.

    However, theres this one .dat file that outputs the data fine into the application, but when i try to save the contents it saves in what appears to be Japanese/Chinese characters.

    㩃啜敳獲䵜歩履潄畣敭瑮屳楌敭楗敲䥜据浯汰瑥履ⵔ㐱㌷ㄴ琭敨猠浩獰湯⁳楢瑴牯敲瑮搠睯汮慯敤⹲楺睰ਂ㩃啜敳 獲䵜歩履潄畣敭瑮屳楌敭楗敲䥜据浯汰瑥履ⵔ㔵㘶㔱猭畯桴瀠牡⹫楺睰ਂ㩃啜敳獲䵜歩履潄畣敭瑮屳楌敭楗敲䥜据 浯汰瑥履ⵔ㔳㔴㈴ⴵ慨瑲敬潰汯嬠㘱欰焠慵楬祴⹝灭眳ਂ㩃啜敳獲䵜歩履潄畣敭瑮屳楌敭楗敲䥜据浯汰瑥履ⵔ㘴㠰 〰ⴰ慯楳⁳*潤❮⁴潬歯戠捡湩愠杮牥洮㍰ɷ䌊尺獕牥屳楍敫䑜捯浵湥獴䱜浩坥物履慓敶層慯楳⁳*潤❮⁴潬歯 戠捡湩愠杮牥洮㍰ɷ琊瑩敬t漅獡獩t琄灹੥㩃啜敳獲䵜歩履潄畣敭瑮屳楌敭楗敲卜癡摥瑜敨猠浩獰湯⁳楢瑴牯 敲瑮搠睯汮慯敤⹲楺睰ਂ㩃啜敳獲䵜歩履潄畣敭瑮屳楌敭楗敲卜癡摥獜畯桴瀠牡⹫楺睰ਂ㩃啜敳獲䵜歩履潄畣敭瑮 屳楌敭楗敲卜癡摥桜牡汴灥潯ㅛ〶畱污瑩嵹洮㍰ɷਊ楆敬传数敮㩤搠睯汮慯獤搮瑡ਮ

    I dont have a clue what to do!

    I cant get my head round it. The save file works fine for other .dat files, just this one file it does that.

    My code is posted below if anyones had a similar problem before or could help please!

    P.S. an example of the output of my program is:

    C:\Users\Jim\Documents\LimeWire\Incomplete\T-147341-the simpsons bittorrent downloader.zipw
    C:\Users\Jim\Documents\LimeWire\Incomplete\T-556615-south park.zipw
    C:\Users\Jim\Documents\LimeWire\Incomplete\T-3545425-hartlepool [160k quality].mp3w
    C:\Users\Jim\Documents\LimeWire\Incomplete\T-4608000-oasis - don't look back in anger.mp3w
    C:\Users\Jim\Documents\LimeWire\Saved\oasis - don't look back in anger.mp3w

    ...and an example of the .dat file itself is:

    sr java.util.ArrayListx™a I sizexp w sr 3com.limegroup.gnutella.downloader.ManagedDownload er&z&uTϥ xr 4com.limegroup.gnutella.downloader.AbstractDownloa derŒȫ*H xpsr java.util.HashSetD…•–4 xpw ?@ sr %com.limegroup.gnutella.RemoteFileDesc[\% Z _browseHostEnabledZ _chatEnabledZ _firewalledZ _http11J _indexI _portI _qualityZ _replyToMulticastI _sizeI _speed[ _clientGUIDt [BL _filenamet Ljava/lang/String;L _hostq ~ L _urnst Ljava/util/Set;L _vendorq ~ [ _xmlDocst -[Lcom/limegroup/gnutella/xml/LimeXMLDocument;L
    propertiesMapt Ljava/util/Map;xp H FP ur [BT xp ^tx6
    oŠρ t $Oasis - Don't Look Back In Anger.mp3t %java.util.Collections$UnmodifiableSet€’я›€U xr ,java.util.Collections$UnmodifiableCollectionB €^ L ct Ljava/util/Collection;xpsq ~ sr com.limegroup.gnutella.UrnSet7YG9߱4 L sha1t Lcom/limegroup/gnutella/URN;L ttrootq ~ xpsr com.limegroup.gnutella.URNbtRo xpw+ )urn:sha1:ZYD7SNSIHCRON7SOGD742UR5PMSRAIO3~r com.limegroup.gnutella.URN$Type xr java.lang.Enum
    Last edited by GraemeH; 04-10-2009 at 09:28 PM.

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Cambridge, UK
    Rep Power


    Likely to be a problem with your input and output methods treating the data as binary/ASCII/Unicode erroneously.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

Similar Threads

  1. [SOLVED] jfilechooser for saving a file....?
    By prabhurangan in forum AWT / Swing
    Replies: 10
    Last Post: 10-06-2013, 10:17 PM
  2. Saving ArrayList to File
    By nwboy74 in forum Advanced Java
    Replies: 6
    Last Post: 12-08-2008, 10:19 AM
  3. Saving to a Text File
    By jadaleus in forum Advanced Java
    Replies: 2
    Last Post: 10-17-2008, 06:50 PM
  4. Saving data in an XML file
    By Thez in forum New To Java
    Replies: 1
    Last Post: 12-08-2007, 09:24 PM

Posting Permissions

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