Writing to text file in GAE - java

Has anyone figured out a way to write to text file on the server-side using Google App Engine (GAE). I understand the limitation of not being able to use FileWriter, but I was wondering if there was a work around. Thanks!

Not only can you not use FileWriter, you can not write to files at all, since you do not have access to the filesystem from within the GAE. It's impossible by design.
As a "work-around" (which I hesistate designating as such since this is a technically valid solution), you can emulate a filesystem using the GAE datastore using GAEVFS: http://code.google.com/p/gaevfs/

Try the blob store. Now, you can write to the blob store like you write files to the file system.
https://developers.google.com/appengine/docs/java/blobstore/overview#Writing_Files_to_the_Blobstore

Related

Casting Azure Blob Item to Java File Object

So the existing code base where I work uses a regular Java File("a/directory/path") object for a massive amount of logic. Now my team wants me to use a file stored in the Azure Blob instead. I can get the file from the blob using the CloudBlobItem() java api. But this object is different than a regular java File() object. And I would have to change a bunch of stuff in the logic. Is there any blob item which can be casted to a regular File() object?
Short answer: No.
You're comparing two completely different things. Azure blobs are not files. You'd need to stream them down to where your code is running. Maybe to a file stream. Maybe write to disk. And then work with the file. You cannot just use an Azure blob like any other file I/O.
Note: If you're using Azure File Storage (which is an SMB share), then you do treat everything in that file store like you'd treat local storage. But it sounds like you're just using normal block blobs for your storage.

AIR Native extension read file with JAVA and handle it with Flash?

I have some files inside my app expansion file accessed with JAVA APKExpansionSupport provided by Google library. I can read files as InputStream, f.e. MP3, but I need to read this file on Flash side (to play it) and don't know how...
My initial idea was to convert the InputStream to FREByteArray but I'm not sure if that's the way. Some hints?
I finally did it through IOUtils.toByteArray conversion (for synchronous solution).

How to manage excel sheets in excel file using java without using 3rd party libraries

I has a excel file with 4 excel sheets in it. Now i want to read or write to required excel sheets using java without using any third party lib.
I know i can read and write data using FileInputStream and FileOutputStream respecitvely. But i can handle the work sheets??
No, you can'not, There is numerous way in Java for reading/writing files, but there is no built-in support for MS Office/Excel spreadsheets. http://poi.apache.org/ - is a key to victory.
If your goal is to interface with data from an excel sheet from your Java application, I'd suggest to use the solutions suggested by other posters, it will save you a lot of work.
If, however, you want to be able to read excel files from Java (or any other programming language for that matter) 'just because you can' then you could take a look at this file and read the instructions on this web-page. I would warn you that it would take considerably more time to implement your own API if you base it only on the file-specs that are publicly available. You might want to check out the work done by the people from the Apache POI project to get an idea of how to approach it. Or (even better) contribute to the project. Here you can find out how to go about doing that

how to load local html file in to j2me?

suppose i have one html file.
Hello World
how i can load this file to browser in j2me.
anyhelp
thankx
There is platformRequest method, but I'm not sure what phones supports opening local files. There is also CHAPI and it maybe provides some way to do such things, but it is probably not widely supported.

What is the best place to read/write/store a small amount of data online?

I want to be able to store, retrieve, and modify a small amount of textual data (< 2 mb) as a CSV online. What service should I use to be able to do this programatically (in Java)?
Try Google Spreadsheets (Java API Reference). You can upload a CSV which gets automatically converted to a spreadsheet, then you can query or edit it programmatically, or manipulate it online, then if you need to get it as CSV you can export it.
You can try Google's App Engine. http://code.google.com/appengine/docs/whatisgoogleappengine.html
Also there is Amazon S3. http://aws.amazon.com/s3/
I know a few Open Source people using these tools to store online persistent data to useful effect.
OpenDHT sounds like it will do what you need it to.
http://www.opendht.org/

Categories

Resources