Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Defines a class that contains file data.
- public class Lump {
- protected string _path;
- protected byte [] _data;
- @property string path () { return _path; }
- protected @property void path (string val) { _path = val; }
- @property byte [] data () { return _data; }
- protected @property void data (byte [] val) { _data = val; }
- // D doesn't have streams in Phobos. What the fuck, man.
- //public System.IO.Stream asStream { get { return new System.IO.MemoryStream (Data, false); } }
- // No default constructor.
- @disable this ();
- /**
- * Defines a new lump.
- *
- * Params:
- * path = The path of the lump.
- * data = The lump's data.
- * dispose = Whether the input stream should be closed and disposed.
- **/
- /*public this (string path, System.IO.Stream data, bool dispose = false) {
- _path = path;
- _data = new byte [data.Length];
- if (data.Position != 0)
- data.Seek (0, System.IO.SeekOrigin.Begin);
- data.Read (Data, 0, (int) data.Length);
- if (dispose) {
- data.Close ();
- data.Dispose ();
- }
- data = null;
- }*/
- /**
- * Defines a new lump.
- *
- * Params:
- * path = The path of the lump.
- * data = The lump's data.
- **/
- public this (string path, byte [] data) {
- _path = path;
- _data [] = data [];
- data = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement