Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copying file



All,
We copy files in our application with additional fork information, but
we have to copy all of the file/resource/info streams manually. I would
love to see even a command-line tool to copy/move files like the finder
does so that we can call it directly.

Also, on NTFS filesystems, they are quite accessible from JAVA. We do
it all of the time and with some effort, you can build an abstraction
layer to cover both Greg's library for OS X and the Windows AFP streams
for windows. Anyway, the names of the forks for windows are as follows:

/**
* ":$DATA" is an Optional Suffix
*/
protected static final String STREAM_NAME_SEPARATOR = ":";
protected static final String STREAM_SUFFIX = STREAM_NAME_SEPARATOR +
"$DATA";

public static final String STREAM_AFPDATA_SUFFIX = STREAM_NAME_SEPARATOR
+ "" + STREAM_SUFFIX;
public static final String STREAM_AFPINFO_SUFFIX = STREAM_NAME_SEPARATOR
+ "AFP_AfpInfo" + STREAM_SUFFIX;
public static final String STREAM_AFPRESOURCE_SUFFIX =
STREAM_NAME_SEPARATOR + "AFP_Resource" + STREAM_SUFFIX;
public static final String STREAM_AFPCOMMENTS_SUFFIX =
STREAM_NAME_SEPARATOR + "Comments" + STREAM_SUFFIX;
public static final String STREAM_AFPDESKTOP_SUFFIX =
STREAM_NAME_SEPARATOR + "AFP_DeskTop" + STREAM_SUFFIX;
public static final String STREAM_AFPIDINDEX_SUFFIX =
STREAM_NAME_SEPARATOR + "AFP_IdIndex" + STREAM_SUFFIX;

So, on NTFS to get the appropriate stream, just append the above
suffixes to the base name and do a file open. For more information,
please see
http://samba.org/doxygen/appliance-head/MacExtensions_8h-source.html.

Regards,
Michael

Philip Holland wrote:

>>Glen Fisher wrote:
>>
>>Philip Holland wrote:
>>| Ideally, it would be hidden from the ser by the underlying
>>implementation
>>
>>Unfortunately, that's not possible. A file fork is not merely part of the
>>file's data; it's a completely separate, self-contained byte stream. (What
>>Unix thinks of as "a file" is merely the "data fork" of a Mac file.)
>>Copying all the forks of a file requires a separate operation for each
>>fork.
>>
>>
>
>OK, so it's much like the situation in NT with NTFS where the so-called
>alternate data streams are inaccessible from Java (although there is little
>need in NT as these are very infrequently used).
>
>I think given Apple's commitment to Java it would be nice to have support
>for accessing alternate forks in the eio API. The only support I can find is
>via the 3rd party MacBinary toolkit
>(http://www.amug.org/~glguerin/sw/index.html#macbinary) which uses JNI to do
>this.
>
>However, there are probably more pressing things which need attention in the
>JDK before this...
>
>
>
>>| I would think that file attributes such as type & creator codes should
>>be
>>| taken care of with a byte level copy
>>
>>Why should they? They're not part of the file's data, any more than the
>>modification time or file owner are. To do what you want, the file-reading
>>methods would have to know how the file data is being used, so that file
>>attributes would be included if the file was being read to be copied, but
>>left out if the file was being read to be used for anything else. (The
>>file-writing methods would have to be similarly omniscient.)
>>
>>
>
>Yes, I see your point. At least these attributes are accessible to us
>through Apple's eio API.
>
>Phil.
>_______________________________________________
>java-dev mailing list | email@hidden
>Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
>Do not post admin requests to the list. They will be ignored.
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >RE: copying file (From: "Philip Holland" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.