Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Newbie File Questions

 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry guys, I've forgotten all my File stuff. Been years.

I'm trying to:
1) Make a backup file of "pork.css", "pork.bak.css"
2) Open "pork.css" and write to it.

here's the basic approach I started.


Which results in:
I think I'm referencing the file wrong. What's the correct way to find the file?

[ June 16, 2006: Message edited by: Garrett Smith ]
[ June 16, 2006: Message edited by: Garrett Smith ]
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simply read the bytes from a FileInputStream and write them to an OutputStream. It is not necessary that you create the file for the OuputStream. It will be created automatically if it does not exist.

For instance, this code copies the bytes from an InputStream into a OutputSream:



You could invoke this code from any other method like this:

 
Don't MAKE me come back there with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic