Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I read Windows NTFS's Alternate Data Stream using Java's IO?  RSS feed

 
John Jeffersonian
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to have my Java application read all the data in a given path. So files, directories, metadata etc. This also includes one weird thing NTFS has called Alternate Data Stream (ADS).

Apparently it's like a second layer of data in a directory or file. You can open the command prompt and create a file in the ADS using ':', for example:

So,

Should open a notepad that contains the string "test" in it. However, if you did:

You will not be able to see ads.txt. However, if you use the dir option that displays ADS data, you will be able to see it:

Now, I am aware that Java IO has the capability to read ADS. How do I know that? Well, Oracle's documentations clearly states so:

If the file attributes supported by your file system implementation
aren't sufficient for your needs, you can use the
UserDefinedAttributeView to create and track your own file attributes.

Some implementations map this concept to features like NTFS
Alternative Data Streams and extended attributes on file systems such
as ext3 and ZFS.


Also, a random post on a random forum :D

The data is stored in NTFS Alternate data streams (ADS) which are
readable through Java IO (I have tested it).


The problem is, I can't find any pre-written file attribute viewer that can parse ADS, and I don't understand how to write an ADS parser of my own. I'm a beginner programmer so I feel this is way over my head. Would anybody please help me out or point me in the right direction?
 
Knute Snortum
Sheriff
Posts: 3545
85
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be upfront about cross-posting:

http://stackoverflow.com/questions/33085253/how-do-i-read-windows-ntfss-alternate-data-stream-using-javas-io
 
John Jeffersonian
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, didn't know it was necessary to do so.
 
Knute Snortum
Sheriff
Posts: 3545
85
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Jeffersonian wrote:Sorry, didn't know it was necessary to do so.

It's considered polite anywhere. Some forums forbid cross posting. Someone could waste his or her time with an answer when a post to the other forum already has that information.
 
Knute Snortum
Sheriff
Posts: 3545
85
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to read the ADS of a file by treating just like a regulate file stream.

 
Campbell Ritchie
Sheriff
Posts: 53723
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Apologies accepted. This question is too difficult for this forum, so I shall try moving it to our IO forum.
 
Knute Snortum
Sheriff
Posts: 3545
85
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is an answer on the other forum now, FYI.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!