theblaine.com

Here's my little spot on the Net

Read Contents of Raw File Sample

Posted by theBlaine March - 30 - 2011 - Wednesday ADD COMMENTS
        InputStream iFile = getResources().openRawResource(R.raw.sample_stream);
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

        int i;
        try {
        	i = iFile.read();
        	while (i != -1)
        	{
        		byteArrayOutputStream.write(i);
        		i = iFile.read();
        	}
        	iFile.close();
        } catch (IOException e) {
        	// TODO Auto-generated catch block
        	e.printStackTrace();
        }

        Log.v(TAG, byteArrayOutputStream.toString());
        Log.i(TAG, "--- Raw stream test ---");

Most Commented

About me

Hi, my name is Blaine Sherman (aka theBlaine). I am a 37 year old Network Administrator by day and a mobile app developer and web app developer at night. I am a proud father of a 16 year old daughter and a mellow cat named Tough Guy. Welcome to my new web site. It is geared towards application development, but will also include tid-bits about my life and my whacky family!! I hope there is at least one thing entertaining or educational you can get from my site. If not, oh well, you will get over it!! Thanks for stopping by my little spot on the Net. ~ Blaine Sherman

Switch to our mobile site