Coder Social home page Coder Social logo

skyeditor.io's Introduction

SkyEditor.IO

File and file system abstractions for file editing code libraries.

IFileSystem Interface

This interface is based on the System.IO.File and System.IO.Directory classes, and allows interaction with both files and directories.

The benefit to using this interface as opposed to the System.IO classes is that other classes (such as a class that interacts with zip files) can implement the interface, and all code that uses this interface will be able to read from that class with no additional modification.

Such a class is not included in this library for the time being.

BinaryFile Class

This class is an abstraction over reading a file from an arbitrary source. Thanks to the IBinaryDataAccessor interfaces, one can read subsets of the file with minimal additional allocations.

This class is thread-safe unless otherwise indicated in the XML documentation. SetLength, the method that resizes a file, is the biggest example of a method that is not thread-safe.

Supported sources (in order of preference):

  • Byte arrays
    • Advantages: fastest, makes use of Memory and Span methods in IBinaryDataAccessor, supports concurrency
    • Disadvantages: uses a lot of memory, can't be used with files that are 2GB in size or larger
    • Resize support: when size is less than 2GB
  • Memory-mapped files
    • Advantages: comparable speed to byte arrays, supports concurrency, supports files over 2GB in size, less memory used compared to byte arrays
    • Disadvangates: no benefit from using Memory or Span methods in IBinaryDataAccessor
    • Resize support: never, must close, resize with a stream, and reopen
  • Streams
    • Advantages: low memory footprint, supports files over 2GB in size
    • Disadvantages: no benefit from using Memory or Span methods in IBinaryDataAccessor, does not support concurrency (locks are used by BinaryFile to ensure thread safety at the cost of speed)
    • Resize support: always

When opening a file from a filename, BinaryFile will choose one of these for you, possibly even changing automatically when resizing the file.

Alternatively, you can use a constructor overload to pass it a byte array, stream, or memory-mapped file directly, at the expense of an exception being thrown when attempting to resize a file inconsistent with the Resize Support listed above.

skyeditor.io's People

Contributors

antymew avatar evandixon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.