// TODO(trinabh): Check ACL stuff here internal ByteValue ReadData(IValue valuePath) { ByteValue byteValue = null; if (null != valuePath) { string dataFilePath = valuePath.ToString(); FileStream fout = new FileStream(dataFilePath, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite); fout.Seek(0, SeekOrigin.Begin); //create new MemoryStream object MemoryStream memStream = new MemoryStream(); byte[] bytes = new byte[fout.Length]; //read file to MemoryStream int bytesRead = 0; fout.Read(bytes, bytesRead, (int)fout.Length); fout.Close(); memStream.Write(bytes, 0, bytes.Length); memStream.SetLength(bytes.Length); byteValue = SerializerHelper <ByteValue> .DeserializeFromByteStream(memStream); } return(byteValue); }