Arun Paul
Arun Paul

Reputation: 81

google appengine not supporting FileOutputStream

I am trying to write to a file in Google appengine but it giving a error message java.io.FileOutputStream is not supported by Google App Engine's Java runtime environment

even though I imported

import java.io.File;
import java.io.FileInputStream;

import java.io.FileOutputStream;
import java.io.IOException;

Upvotes: 6

Views: 7426

Answers (3)

Vishal Biyani
Vishal Biyani

Reputation: 4407

GAE platform allows only read access to Filesystem within scope pf application files. If at all you have to write something, Datastore and Blobstore is the place to write to!

Upvotes: 0

Stevko
Stevko

Reputation: 4495

Have you tried using java.io.ByteArrayOutputStream rather than FileOutputStream?

This should allow you to use your external libraries that require files but still work within the GAE JRE white list

Upvotes: 3

Strelok
Strelok

Reputation: 51451

Well it's not a java compiler error. This class is a restricted API in Google App Engine you are not allowed to use it.

Read about the GAE Java Runtime Environment and restrictions here: http://code.google.com/appengine/docs/java/runtime.html

The closest you will get to file storage on GAE is the Blobstore API: http://code.google.com/appengine/docs/java/blobstore/

If you need to create files in code GAE is not an appropriate platform for you.

Upvotes: 10

Related Questions