开发者

Storing and retrieving data from text files in Java [closed]

开发者 https://www.devze.com 2023-01-04 06:40 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 y开发者_JAVA技巧ears ago.

What is the most common approach to storing and retreiving data from text files in Java and more specifically in Android projects?


This isn't specific to Android, but you'd want to create a java.io.File and perhaps use a java.util.Scanner to read it (if it's text). Otherwise you'll create java.io.InputStream and work from that.

Depending on what format you want to use and the nature of the data, you can also use things like java.util.Properties, XML, etc.

See also

  • Java Tutorial - Essential Classes - Basic I/O
    • I/O Streams
      • Byte streams
      • Character streams
      • Buffered streams
      • Scanning and formatting

developer.android.com links

  • package java.io at developer.android.com
  • Developer's guide
    • Application resources
    • Data Storage
      • Shared Preferences/Internal Storage/External Storage
      • SQLite Databases/Network Connection
0

精彩评论

暂无评论...
验证码 换一张
取 消