File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Copying contents... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Copying contents..." Watch "Copying contents..." New topic

Copying contents...

Kedar Patwardhan

Joined: Jan 24, 2007
Posts: 8
I want to ask that whether there are any APIs in Java so that we can copy the contents of a TextFile to another TextFile alongwith all TEXT properties(if they exist)in the base Textfile.By TEXT properties I mean (if the text content is BOLD or UNDERLINED or COLOURED) then it should carry all these properties to the newly created TextFile as well.

Thank You,

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Plain text doesn't have attributes like styles and the like - what kind of format are you using? And what do you mean by "copying" - making an exact copy of the file with a different name? To do that you wouldn't need to be concerned about file contents, though.
tarun bhati

Joined: May 24, 2003
Posts: 1
We dont have any API for copying the text formats in the Java API
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
You could just copy the file using

With InputStream you could read the bytestream of the file and with OutputStream you could copy it to a different location.

See the following link
linkCopying One File to Another

Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
I agree. Here's the link:
subject: Copying contents...
It's not a secret anymore!