Created
March 13, 2012 15:09
-
-
Save amacdougall/2029335 to your computer and use it in GitHub Desktop.
Quick and dirty AIR filestream test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
// imports | |
import flash.display.*; | |
import flash.events.*; | |
import flash.filesystem.*; | |
import flash.text.TextField; | |
/** | |
* Quick and dirty AIR file stream test. | |
*/ | |
public class AirFileStream extends Sprite { | |
/* INSTANCE VARIABLES */ | |
/* INSTANCE METHODS */ | |
public function AirFileStream() { | |
testFileRead(); | |
} | |
public function testFileRead():void { | |
var file:File = new File(File.userDirectory.resolvePath("test.txt")); | |
var fileStream:FileStream = new FileStream(); | |
fileStream.open(file, FileMode.READ); | |
var text:String = fileStream.readMultiByte(file.size, File.systemCharset); | |
trace("Read file contents:"); | |
trace(text); | |
fileStream.close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment