Ashish Tamrakar
Ashish Tamrakar

Reputation: 820

Store ByteArrayOutputStream in SD Card

I am getting a ByteArrayOutputStream of Camera and want to Store this video stream into SD Card as a file, file extension would be anything.

How can I fetch streaming and store it into SD Card,as I am getting a live camera stream and want to update that continously in SD Card.

Could you please provide me a sample tutorials related to camera streaming.

Thanks.

Upvotes: 1

Views: 1517

Answers (1)

Changwei Yao
Changwei Yao

Reputation: 13101

private void save(ByteArrayOutputStream os){
        FileOutputStream fos;
        try {
            fos = new FileOutputStream("/sdcard/your_position");
            os.writeTo(fos);
            os.flush();
            fos.flush();
            os.close();
            fos.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }           
    }

Hope can solve your problem.

Upvotes: 4

Related Questions