GoogleCloudPlatform / appengine-gcs-client

App Engine-Cloud Storage custom client library
Apache License 2.0
124 stars 112 forks source link

I keep getting invalid stream header error #4

Open mkawia opened 9 years ago

mkawia commented 9 years ago

This is the code ,just like in the official documentation

GcsInputChannel readChannel = gcsService.openPrefetchingReadChannel(gcsFileName, 0, 1024 * 1024); try (ObjectInputStream oin = new ObjectInputStream( Channels.newInputStream(readChannel))) { return oin.readObject(); }

I get an error in the ObjectInputStream everytime ,please help I need to be able to create an InputStream object . However If I serve to a HTTPRESPONSE object it work ,But I also want to use it tis way

tkaitchuck commented 9 years ago

You'll have to paste the error. (Probably also how you are writing the file) If you are getting a cast exception it could be you aren't serializing the object in the symmetric way to how it is being deserialized. If you are getting an early end of the stream it could be the file is being truncated for some reason. (Check that the file is the size you expect in the console)