Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4722289

(fs) Add FileChannel.transfer(long srcPos, long dstPos, long count) method

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs
    • Fix Understood
    • x86
    • windows_2000



      Name: nt126004 Date: 07/29/2002


      FULL PRODUCT VERSION :
      java version "1.4.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
      Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      add a method to FileChannel that does something like the following:

      long transfer(long aFromPosition, long aToPosition, long aCount)

      this method would transfer aCount bytes from within the same
      FileChannel to somewhere else in the same FileChannel

      Currently it is unclear what should happen when using the tranferTo / transferFrom methods to accomplish the same thing. For example when transferring bytes on our system using transferTo(2, 5, channel) with channel position at 4
      abcdefghijk --> abcdcdcdcjk
      one might expect --> abcdcdefgjk

      The behaviour of the new method should be as though the
      transferred data was 1st written out to a temp location and
      then written into the file at the new location.

      If aToPosition is before aFromPosition the the behaviour at
      the momment is fine (assuming it works the same on all
      platforms).
      If aToPosition == aFromPosition then nothing needs to be done.
      If aFromPosition is before aToPosition then either blocks of
      no more than (aToPosition - aFromPosition) should be
      transferred at a time starting from the end of the file and
      working back, or some other method should be used such that
      in the case above abcdefghijk --> abcdcdefgjk
       



      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER WORKAROUND :
      write the method ourselves (wont be as efficient as file
      systems would allow)
      (Review ID: 153679)
      ======================================================================

            Unassigned Unassigned
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: