Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Android Data Persistence File Storage Writing to Internal Storage

Harry James
Harry James
14,780 Points

Method that should be in the Teacher Notes

Evan talks about the copyFile() method that should be in the Teacher Notes however, it seems as though it isn't!

Here's the method for easy copying/pasting for any students that want to use it:

    private static void copyFile(InputStream in, OutputStream out) throws IOException {
        byte[] buffer = new byte[1024];
        int read;
        while((read = in.read(buffer)) != -1) {
            out.write(buffer, 0, read);
        }
    }

Hope it helps! :)

Jacob Bergdahl
Jacob Bergdahl
29,118 Points

Thank you, Harry. I think that was pretty sloppy of Evan to not make sure that it was there. Especially since it's been at least five months, probably more, since.

Sexual Potatoes
Sexual Potatoes
12,051 Points

Thanks. This course is a mess.

4 Answers

Harry James
Harry James
14,780 Points

Marking as resolved

Thank you for posting this. Not only is it not posted in the teacher notes, the video also runs off the screen and you can't see the { you need... but you can't get to the treehouse community forum on the app on the phone, so I wound up finding the code on Stack Overflow.

Ni Yao
Ni Yao
3,852 Points

2 years later and the notes still haven't been fixed.

While it is resolved, Treehouse needs to fix it as having every single person who pass through here spend even 15 secs to find it is wasting a huge amount of cumulative human hours.

This course is a mess.

Susan Jensen , looking the code up to find out what it you need is a learning experience itself, congratulations. You will find yourself doing that plenty of times during the process of coding apps.

peter doherty
peter doherty
6,690 Points

Thanks, Harry James.

Why hasn't this method been added to the teacher's notes, Treehouse?