Search code examples
javajava-megetresource

getResourceStream for writing files


For javame.

Since getResourceAsStream() is for reading files, is there a getResourceAsStream() equivalent for output stream / writing files?

Note: the file is inside the project's folders and will soon be packaged into a jarfile.


Solution

  • getResoureAsStream() deals with resources. Returning an output stream doesn't make sense because that implies you are trying to overwrite your resources on the fly.

    Besides, for most resources residing in a JAR or remote locations, you can't write to it anyway.