File Copy Problem....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    File Copy Problem....

    Can you post the best URL/Tutorial site for high quality file copying of .COM file?

    JoshAH?, BigDaddy?, roXxxxx?, how will you guys handle this? Please help...

    I've surf the net, but all i can see are for .jpg or imaging files and text files copy...

    This is my new problem as of now...

    Im waiting for your replies... ;-(
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by sukatoa
    Can you post the best URL/Tutorial site for high quality file copying of .COM file?

    JoshAH?, BigDaddy?, roXxxxx?, how will you guys handle this? Please help...

    I've surf the net, but all i can see are for .jpg or imaging files and text files copy...

    This is my new problem as of now...

    Im waiting for your replies... ;-(
    What is so special about a .com file? I guess it isn't a text file so don't use a
    Reader and Writer for the copying. Use simple InputStreams and OutputStreams
    for the copy action, i.e. create the streams (File streams) and keep on reading
    and writing until you've read all the bytes and written them. That scenario works
    with all sorts of files.

    kind regards,

    Jos

    Comment

    • sukatoa
      Contributor
      • Nov 2007
      • 539

      #3
      Originally posted by JosAH
      What is so special about a .com file? I guess it isn't a text file so don't use a
      Reader and Writer for the copying. Use simple InputStreams and OutputStreams
      for the copy action, i.e. create the streams (File streams) and keep on reading
      and writing until you've read all the bytes and written them. That scenario works
      with all sorts of files.

      kind regards,

      Jos
      .COM file? Im currently developing an A86 IDE... Just a simple editor...
      I need to transfer that .COM file generated to the specified directory...

      Previously i used that FileWriter and FileReader... The behavior of the copied .COm file is bad... I suspect it was from my implementation. .. I also posted it in one of my threads here in the forum...

      Thanks Jos...

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by sukatoa
        .COM file? Im currently developing an A86 IDE... Just a simple editor...
        I need to transfer that .COM file generated to the specified directory...

        Previously i used that FileWriter and FileReader... The behavior of the copied .COm file is bad... I suspect it was from my implementation. .. I also posted it in one of my threads here in the forum...

        Thanks Jos...
        As I wrote: don't use Readers and Writers for non-text files; use Streams instead.
        Those Readers and Writers try to encode/decode characters (two bytes); those
        Streams just take those bytes as they are and don't do anything special to them.

        kind regards,

        Jos

        Comment

        • sukatoa
          Contributor
          • Nov 2007
          • 539

          #5
          Originally posted by JosAH
          As I wrote: don't use Readers and Writers for non-text files; use Streams instead.
          Those Readers and Writers try to encode/decode characters (two bytes); those
          Streams just take those bytes as they are and don't do anything special to them.

          kind regards,

          Jos
          I've encounter FileChannel class @ API...
          Using .transferFrom() method...

          When we compare this with your reply Jos, what's the difference?
          When the file are copied... Does it has any difference?

          Jo's, i have implemented your suggestions, will this code could also capable for copying an MB size of file? or greater like GB size?

          waiting for your reply

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by sukatoa
            I've encounter FileChannel class @ API...
            Using .transferFrom() method...

            When we compare this with your reply Jos, what's the difference?
            When the file are copied... Does it has any difference?

            Jo's, i have implemented your suggestions, will this code could also capable for copying an MB size of file? or greater like GB size?

            waiting for your reply
            The difference is that my solution just uses the java.io package and your solution
            uses the java.nio package directly. The FileStreams use those channels under the
            hood. Streams (as well as Channels) don't care about the size of the file.

            kind regards,

            Jos

            ps. it may be a nice exercise to just use those channels; try it.

            Comment

            • sukatoa
              Contributor
              • Nov 2007
              • 539

              #7
              Originally posted by JosAH
              The difference is that my solution just uses the java.io package and your solution
              uses the java.nio package directly. The FileStreams use those channels under the
              hood. Streams (as well as Channels) don't care about the size of the file.

              kind regards,

              Jos

              ps. it may be a nice exercise to just use those channels; try it.
              Yah, you got it... your a GODLIKE....Jos. .

              thanks again...

              Comment

              Working...