The AndroidFileIO Class

The original FileIO interface was lean and mean. It contained four methods: one to get an InputStream for an asset, another to get an InputStream for a file in the external storage, a third that returned an OutputStream for a file on the external storage device, and a final one that got the SharedPreferences for the game. In Chapter 4, you learned how to open assets and files on the external storage using Android APIs. Listing 5–1 presents the implementation of the FileIO interface, based on knowledge from Chapter 4.

Listing 5–1. AndroidFileIO.java; Implementing the FileIO Interface

package com.badlogic.androidgames.framework.impl; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; ...

Get Beginning Android 4 Games Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.