diff --git a/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php b/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
new file mode 100644
index 0000000..29001e3
--- /dev/null
+++ b/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
@@ -0,0 +1,207 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\StreamWrapper\LocalReadOnlyStream.
+ */
+
+namespace Drupal\Core\StreamWrapper;
+
+/**
+ * Defines a read-only Drupal stream wrapper base class for local files.
+ *
+ * This class extends the complete stream wrapper implementation in LocalStream.
+ * URIs such as "public://example.txt" are expanded to a normal filesystem path
+ * such as "sites/default/files/example.txt" and then PHP filesystem functions are
+ * invoked.
+ *
+ * Drupal\Core\StreamWrapper\LocalReadOnlyStream implementations need to
+ * implement at least the getDirectoryPath() and getExternalUrl() methods.
+ */
+abstract class LocalReadOnlyStream extends LocalStream {
+
+  /**
+   * Support for fopen(), file_get_contents(), etc.
+   *
+   * Any write modes will be rejected, as this is a read-only stream wrapper.
+   *
+   * @param string $uri
+   *   A string containing the URI to the file to open.
+   * @param int $mode
+   *   The file mode (only "r" is supported for the read-only stream wrapper.)
+   * @param int $options
+   *   A bit mask of STREAM_USE_PATH and STREAM_REPORT_ERRORS.
+   * @param string $opened_path
+   *   A string containing the path actually opened.
+   *
+   * @return bool
+   *   Returns TRUE if $mode == "r" and the file was opened successfully.
+   *
+   * @see http://php.net/manual/streamwrapper.stream-open.php
+   */
+  public function stream_open($uri, $mode, $options, &$opened_path) {
+    if ($mode != "r") {
+      return FALSE;
+    }
+
+    $this->uri = $uri;
+    $path = $this->getLocalPath();
+    $this->handle = ($options & STREAM_REPORT_ERRORS) ? fopen($path, $mode) : @fopen($path, $mode);
+
+    if ((bool) $this->handle && $options & STREAM_USE_PATH) {
+      $opened_path = $path;
+    }
+
+    return (bool) $this->handle;
+  }
+
+  /**
+   * Support for flock().
+   *
+   * An exclusive lock attempt will be rejected, as this is a read-only stream
+   * wrapper.
+   *
+   * @param int $operation
+   *   One of the following:
+   *   - LOCK_SH to acquire a shared lock (reader).
+   *   - LOCK_EX to acquire an exclusive lock (writer).
+   *   - LOCK_UN to release a lock (shared or exclusive).
+   *   - LOCK_NB if you don't want flock() to block while locking (not
+   *     supported on Windows).
+   *
+   * @return bool
+   *   Return FALSE for an exclusive lock (writer), as this is a read-only
+   *   stream wrapper.  Return TRUE for all other valid $operations.
+   *
+   * @see http://php.net/manual/streamwrapper.stream-lock.php
+   */
+  public function stream_lock($operation) {
+    if (in_array($operation, array(LOCK_EX, LOCK_EX | LOCK_NB))) {
+      return FALSE;
+    }
+    if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_NB))) {
+      return flock($this->handle, $operation);
+    }
+
+    return TRUE;
+  }
+
+
+  /**
+   * Support for fwrite(), file_put_contents() etc.
+   *
+   * Data will not be written as this is a read-only stream wrapper.
+   *
+   * @param string $data
+   *   The string to be written.
+   *
+   * @return bool
+   *   FALSE as data will not be written.
+   *
+   * @see http://php.net/manual/en/streamwrapper.stream-write.php
+   */
+  public function stream_write($data) {
+    return FALSE;
+  }
+
+  /**
+   * Support for fflush().
+   *
+   * Nothing will be output to the file, as this is a read-only stream wrapper.
+   *
+   * @return bool
+   *   FALSE, as no data will be stored.
+   *
+   * @see http://php.net/manual/streamwrapper.stream-flush.php
+   */
+  public function stream_flush() {
+    return FALSE;
+  }
+
+  /**
+   * Support for unlink().
+   *
+   * The file will not be deleted from the stream as this is a read-only stream
+   * wrapper.
+   *
+   * @param string $uri
+   *   A string containing the uri to the resource to delete.
+   *
+   * @return bool
+   *   TRUE so that file_delete() will remove db reference to file. File is not
+   *   actually deleted.
+   *
+   * @see http://php.net/manual/en/streamwrapper.unlink.php
+   */
+  public function unlink($uri) {
+    return TRUE;
+  }
+
+  /**
+   * Support for rename().
+   *
+   * The file will not be renamed as this is a read-only stream wrapper.
+   *
+   * @param string $from_uri,
+   *   The uri to the file to rename.
+   * @param string $to_uri
+   *   The new uri for file.
+   *
+   * @return bool
+   *   FALSE as file will never be renamed.
+   *
+   * @see http://php.net/manual/en/streamwrapper.rename.php
+   */
+  public function rename($from_uri, $to_uri) {
+    return FALSE;
+  }
+
+  /**
+   * Support for mkdir().
+   *
+   * Directory will never be created as this is a read-only stream wrapper.
+   *
+   * @param string $uri
+   *   A string containing the URI to the directory to create.
+   * @param int $mode
+   *   Permission flags - see mkdir().
+   * @param int $options
+   *   A bit mask of STREAM_REPORT_ERRORS and STREAM_MKDIR_RECURSIVE.
+   *
+   * @return bool
+   *   FALSE as directory will never be created.
+   *
+   * @see http://php.net/manual/en/streamwrapper.mkdir.php
+   */
+  public function mkdir($uri, $mode, $options) {
+    return FALSE;
+  }
+
+  /**
+   * Support for rmdir().
+   *
+   * Directory will never be deleted as this is a read-only stream wrapper.
+   *
+   * @param string $uri
+   *   A string containing the URI to the directory to delete.
+   * @param int $options
+   *   A bit mask of STREAM_REPORT_ERRORS.
+   *
+   * @return bool
+   *   FALSE as directory will never be deleted.
+   *
+   * @see http://php.net/manual/en/streamwrapper.rmdir.php
+   */
+  public function rmdir($uri, $options) {
+    return FALSE;
+  }
+
+  /**
+   * Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::chmod().
+   *
+   * Does not change file permissions as this is a read-only stream wrapper.
+   */
+  public function chmod($mode) {
+    return FALSE;
+  }
+}
diff --git a/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php b/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
new file mode 100644
index 0000000..6293466
--- /dev/null
+++ b/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
@@ -0,0 +1,241 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\StreamWrapper\ReadOnlyStream.
+ */
+
+namespace Drupal\Core\StreamWrapper;
+
+/**
+ * Defines a read-only Drupal stream wrapper base class.
+ *
+ * This class provides a minimal-read only stream wrapper implementation.
+ * Specifically, it only implements the writing classes and read classes where
+ * we need to restrict 'write-capable' arguments.
+ *
+ * Drupal\Core\StreamWrapper\ReadOnlyStream implementations need to implement
+ * all the read-related classes.
+ */
+abstract class ReadOnlyStream implements StreamWrapperInterface {
+  /**
+   * Stream context resource.
+   *
+   * @var resource
+   */
+  public $context;
+
+  /**
+   * A generic resource handle.
+   *
+   * @var resource
+   */
+  public $handle = NULL;
+
+  /**
+   * Instance URI (stream).
+   *
+   * A stream is referenced as "scheme://target".
+   *
+   * @var string
+   */
+  protected $uri;
+
+  /**
+   * Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::setUri().
+   */
+  function setUri($uri) {
+    $this->uri = $uri;
+  }
+
+  /**
+   * Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getUri().
+   */
+  function getUri() {
+    return $this->uri;
+  }
+
+  /**
+   * Support for fopen(), file_get_contents(), etc.
+   *
+   * Any write modes will be rejected, as this is a read-only stream wrapper.
+   *
+   * @param string $uri
+   *   A string containing the URI to the file to open.
+   * @param int $mode
+   *   The file mode (only "r" is supported for the read-only stream wrapper.)
+   * @param int $options
+   *   A bit mask of STREAM_USE_PATH and STREAM_REPORT_ERRORS.
+   * @param string $opened_path
+   *   A string containing the path actually opened.
+   *
+   * @return bool
+   *   Returns TRUE if $mode == "r" and the file was opened successfully.
+   *
+   * @see http://php.net/manual/streamwrapper.stream-open.php
+   */
+  public function stream_open($uri, $mode, $options, &$opened_path) {
+    if ($mode != "r") {
+      return FALSE;
+    }
+
+    $this->uri = $uri;
+    $path = $this->getLocalPath();
+    $this->handle = ($options & STREAM_REPORT_ERRORS) ? fopen($path, $mode) : @fopen($path, $mode);
+
+    if ((bool) $this->handle && $options & STREAM_USE_PATH) {
+      $opened_path = $path;
+    }
+
+    return (bool) $this->handle;
+  }
+
+  /**
+   * Support for flock().
+   *
+   * An exclusive lock attempt will be rejected, as this is a read-only stream
+   * wrapper.
+   *
+   * @param int $operation
+   *   One of the following:
+   *   - LOCK_SH to acquire a shared lock (reader).
+   *   - LOCK_EX to acquire an exclusive lock (writer).
+   *   - LOCK_UN to release a lock (shared or exclusive).
+   *   - LOCK_NB if you don't want flock() to block while locking (not
+   *     supported on Windows).
+   *
+   * @return bool
+   *   Return FALSE for an exclusive lock (writer), as this is a read-only
+   *   stream wrapper.  Return TRUE for all other valid $operations.
+   *
+   * @see http://php.net/manual/streamwrapper.stream-lock.php
+   */
+  public function stream_lock($operation) {
+    if (in_array($operation, array(LOCK_EX, LOCK_EX | LOCK_NB))) {
+      return FALSE;
+    }
+    if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_NB))) {
+      return flock($this->handle, $operation);
+    }
+
+    return TRUE;
+  }
+
+  /**
+   * Support for fwrite(), file_put_contents() etc.
+   *
+   * Data will not be written as this is a read-only stream wrapper.
+   *
+   * @param string $data
+   *   The string to be written.
+   *
+   * @return bool
+   *   FALSE as data will not be written.
+   *
+   * @see http://php.net/manual/en/streamwrapper.stream-write.php
+   */
+  public function stream_write($data) {
+    return FALSE;
+  }
+
+  /**
+   * Support for fflush().
+   *
+   * Nothing will be output to the file, as this is a read-only stream wrapper.
+   *
+   * @return bool
+   *   FALSE, as no data will be stored.
+   *
+   * @see http://php.net/manual/streamwrapper.stream-flush.php
+   */
+  public function stream_flush() {
+    return FALSE;
+  }
+
+  /**
+   * Support for unlink().
+   *
+   * The file will not be deleted from the stream as this is a read-only stream
+   * wrapper.
+   *
+   * @param string $uri
+   *   A string containing the uri to the resource to delete.
+   *
+   * @return bool
+   *   TRUE so that file_delete() will remove db reference to file. File is not
+   *   actually deleted.
+   *
+   * @see http://php.net/manual/en/streamwrapper.unlink.php
+   */
+  public function unlink($uri) {
+    return TRUE;
+  }
+
+  /**
+   * Support for rename().
+   *
+   * This file will not be renamed as this is a read-only stream wrapper.
+   *
+   * @param string $from_uri,
+   *   The uri to the file to rename.
+   * @param string $to_uri
+   *   The new uri for file.
+   *
+   * @return bool
+   *   FALSE as file will never be renamed.
+   *
+   * @see http://php.net/manual/en/streamwrapper.rename.php
+   */
+  public function rename($from_uri, $to_uri) {
+    return FALSE;
+  }
+
+  /**
+   * Support for mkdir().
+   *
+   * Directory will never be created as this is a read-only stream wrapper.
+   *
+   * @param string $uri
+   *   A string containing the URI to the directory to create.
+   * @param int $mode
+   *   Permission flags - see mkdir().
+   * @param int $options
+   *   A bit mask of STREAM_REPORT_ERRORS and STREAM_MKDIR_RECURSIVE.
+   *
+   * @return bool
+   *   FALSE as directory will never be created.
+   *
+   * @see http://php.net/manual/en/streamwrapper.mkdir.php
+   */
+  public function mkdir($uri, $mode, $options) {
+    return FALSE;
+  }
+
+  /**
+   * Support for rmdir().
+   *
+   * Directory will never be deleted as this is a read-only stream wrapper.
+   *
+   * @param string $uri
+   *   A string containing the URI to the directory to delete.
+   * @param int $options
+   *   A bit mask of STREAM_REPORT_ERRORS.
+   *
+   * @return bool
+   *   FALSE as directory will never be deleted.
+   *
+   * @see http://php.net/manual/en/streamwrapper.rmdir.php
+   */
+  public function rmdir($uri, $options) {
+    return FALSE;
+  }
+
+  /**
+   * Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::chmod().
+   *
+   * Does not change file permissions as this is a read-only stream wrapper.
+   */
+  public function chmod($mode) {
+    return FALSE;
+  }
+}
diff --git a/core/modules/file/tests/file_test/file_test.module b/core/modules/file/tests/file_test/file_test.module
index d4a4359..e988cd7 100644
--- a/core/modules/file/tests/file_test/file_test.module
+++ b/core/modules/file/tests/file_test/file_test.module
@@ -42,6 +42,11 @@ function file_test_stream_wrappers() {
       'class' => 'Drupal\file_test\DummyRemoteStreamWrapper',
       'description' => t('Dummy wrapper for simpletest (remote).'),
     ),
+    'dummy-readonly' => array(
+      'name' => t('Dummy files (readonly)'),
+      'class' => 'Drupal\file_test\DummyReadOnlyStreamWrapper',
+      'description' => t('Dummy wrapper for simpletest (readonly).'),
+    ),
   );
 }
 
diff --git a/core/modules/file/tests/file_test/lib/Drupal/file_test/DummyReadOnlyStreamWrapper.php b/core/modules/file/tests/file_test/lib/Drupal/file_test/DummyReadOnlyStreamWrapper.php
new file mode 100644
index 0000000..ae357f3
--- /dev/null
+++ b/core/modules/file/tests/file_test/lib/Drupal/file_test/DummyReadOnlyStreamWrapper.php
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\file_test\DummyStreamWrapper.
+ */
+
+namespace Drupal\file_test;
+
+use Drupal\Core\StreamWrapper\LocalReadOnlyStream;
+
+/**
+ * Helper class for testing the stream wrapper registry.
+ *
+ * Dummy stream wrapper implementation (dummy://).
+ */
+class DummyReadOnlyStreamWrapper extends LocalReadOnlyStream {
+  function getDirectoryPath() {
+    return variable_get('stream_public_path', 'sites/default/files');
+  }
+
+  /**
+   * Override getInternalUri().
+   *
+   * Return a dummy path for testing.
+   */
+  function getInternalUri() {
+    return '/dummy/example.txt';
+  }
+
+  /**
+   * Override getExternalUrl().
+   *
+   * Return the HTML URI of a public file.
+   */
+  function getExternalUrl() {
+    return '/dummy/example.txt';
+  }
+}
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php b/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php
new file mode 100644
index 0000000..7bdf3d6
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php
@@ -0,0 +1,98 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\system\Tests\File\FileTestBase.
+ */
+
+namespace Drupal\system\Tests\File;
+
+/**
+ * Tests that files can not be written using ReadOnlyStreamWrapper functions.
+ */
+abstract class ReadOnlyStreamWrapperTest extends FileTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('file_test');
+
+  protected $scheme = 'dummy-readonly';
+  protected $classname = 'Drupal\file_test\DummyReadOnlyStreamWrapper';
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Read only stream wrapper',
+      'description' => 'Tests the read-only stream wrapper write functions.',
+      'group' => 'File API',
+    );
+  }
+
+  function setUp() {
+    parent::setUp();
+    drupal_static_reset('file_get_stream_wrappers');
+  }
+
+  function tearDown() {
+    parent::tearDown();
+    stream_wrapper_unregister($this->scheme);
+  }
+
+  /**
+   * Test the mkdir() function.
+   */
+  function testWriteFunctions() {
+
+    // Generate a file path
+    $filepath = 'Файл для тестирования ' . $this->randomName();
+    $readonlyuri = $this->scheme . '://' . $filepath;
+    // Create a test file
+    $uri = createUri($filepath);
+    $instance = file_stream_wrapper_get_instance_by_uri($readonlyuri);
+
+    // Test the stream_open() function
+    $this->assertFalse($instance->stream_open($readonlyuri, 'w+'), 'Unable to open (fopen) a file for writing with the read-only stream wrapper.');
+    $this->assertTrue($instance->stream_open($readonlyuri, 'r'), 'Able to open (fopen) a file for writing with the read-only stream wrapper.');
+
+    // Test the chmod() function by attempting to change directory permissions.
+    $this->assertFalse($instance->chmod(0777), 'Unable to chmod() file permissions when using read-only stream wrapper.');
+
+    // Test the stream_lock() function
+    $this->assertFalse($instance->stream_lock(LOCK_EX | LOCK_NB), 'Unable to acquire an exclusive lock using the read-only stream wrapper.');
+
+    // Test the stream_write() function
+    $this->assertFalse($instance->stream_write($this->randomName()), 'Unable to write to file using the read-only stream wrapper.');
+
+    // Test the stream_flush() function
+    $this->assertFalse($instance->stream_flush(), 'Unable to flush output to file using the read-only stream wrapper.');
+
+    $this->assertTrue($instance->stream_close(), 'Able to close file using the read_only stream wrapper.');
+
+    // Test the rename() function
+    $this->assertFalse($instance->rename($readonlyuri, $this->scheme . '://newname.txt'), 'Unable to rename files using the read-only stream wrapper.');
+
+    // Test the unlink() function
+    $this->assertTrue($instance->unlink($readonlyuri), 'Able to unlink file using read-only stream wrapper.');
+    $this->assertTrue($instance->stream_open($readonlyuri, 'r'), 'Unlink File was not actually deleted.');
+    $instance->stream_close();
+
+    // Test the mkdir() function by attempting to create a directory.
+    $dirname = $this->randomName();
+    $dirpath = file_default_scheme() . '://' . $dirname;
+    $readonlypath = $this->scheme . '://' . $dirname;
+    $this->assertFalse(is_dir($dirpath) || is_dir($readonlypath), 'Directory does not exist prior to testing.');
+    $this->assertFalse($instance->mkdir($readonlypath), 'Unable to create directory with read-only stream wrapper.');
+    $this->assertTrue(drupal_mkdir($path) && is_dir($path), 'Able to create directory using default file scheme.');
+
+    // Make sure directory can be seen by the read-only stream wrapper.
+    $this->assertTrue(is_dir($readonlypath), 'Directory found using the read-only stream wrapper.');
+
+    // Test the rmdir() function by attempting to remove the directory.
+    $this->assertFalse(drupal_rmdir($readonlypath), 'Unable to delete directory with read-only stream wrapper');
+    // Remove the directory using the default streamwrapper.
+    $this->assertTrue(drupal_rmdir($path), 'Able to delete the directory with default file scheme.');
+
+  }
+}
