-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for resource for as data stream #254
- Loading branch information
1 parent
a28741f
commit 725b9d6
Showing
15 changed files
with
325 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
"""The HFS data stream implementation.""" | ||
|
||
from dfvfs.vfs import data_stream | ||
|
||
|
||
class HFSDataStream(data_stream.DataStream): | ||
"""File system data stream that uses pyfshfs.""" | ||
|
||
def __init__(self, fshfs_data_stream): | ||
"""Initializes the data stream. | ||
Args: | ||
fshfs_data_stream (pyfshfs.data_stream): HFS data stream. | ||
""" | ||
super(HFSDataStream, self).__init__() | ||
self._fshfs_data_stream = fshfs_data_stream | ||
self._name = '' | ||
|
||
if fshfs_data_stream: | ||
self._name = 'rsrc' | ||
|
||
@property | ||
def name(self): | ||
"""str: name.""" | ||
return self._name | ||
|
||
def IsDefault(self): | ||
"""Determines if the data stream is the default (data fork) data stream. | ||
Returns: | ||
bool: True if the data stream is the default (data fork) data stream. | ||
""" | ||
return not self._fshfs_data_stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
"""Tests for the data stream implementation using pyfshfs.""" | ||
|
||
import unittest | ||
|
||
from dfvfs.vfs import hfs_data_stream | ||
|
||
from tests import test_lib as shared_test_lib | ||
|
||
|
||
class HFSDataStreamTest(shared_test_lib.BaseTestCase): | ||
"""Tests the HFS data stream.""" | ||
|
||
def testName(self): | ||
"""Test the name property.""" | ||
test_data_stream = hfs_data_stream.HFSDataStream(None) | ||
self.assertEqual(test_data_stream.name, '') | ||
|
||
def testIsDefault(self): | ||
"""Test the IsDefault function.""" | ||
test_data_stream = hfs_data_stream.HFSDataStream(None) | ||
result = test_data_stream.IsDefault() | ||
self.assertTrue(result) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Oops, something went wrong.