 public class BinaryFile {
     public let fileDescriptor: FileDescriptor
     private let closeOnDeinit: Bool
-
+    
     public struct Error {
         public let code: ErrorCode
         public let message: String

        return .Success(position)
    }
    
    public func size() -> Result<FileSize> {
        var status = stat()
        let result = fstat(fileDescriptor, &status)
        if result < 0 { return .Failure(Error(code: errno)) }
        return .Success(status.st_size)
    }
    
    public func resize(size: FileSize) -> Result<FileSize> {
        let result = ftruncate(fileDescriptor, size)
        if result < 0 { return .Failure(Error(code: errno)) }
        return .Success(size)
    }

    public enum MapMode {
        case Private
        case ReadOnly
        case ReadWrite
    }

    public func map(order: ByteOrder, mode: MapMode) -> Result<ByteBuffer> {
        let sizeResult = size()
        if let error = sizeResult.error { return .Failure(error) }
        return map(order, mode: mode, position: FilePosition(0), size: sizeResult.value)
    }
    
    public func map(order: ByteOrder, mode: MapMode, position: FilePosition, size: FileSize) -> Result<ByteBuffer> {
        var pointer: UnsafeMutablePointer<()>
        switch mode {
        case .Private:
            pointer = mmap(UnsafeMutablePointer<UInt8>(0), UInt(size), PROT_READ | PROT_WRITE, MAP_PRIVATE, fileDescriptor, position)
        case .ReadOnly:
            pointer = mmap(UnsafeMutablePointer<UInt8>(0), UInt(size), PROT_READ, MAP_SHARED, fileDescriptor, position)
        case .ReadWrite:
            pointer = mmap(UnsafeMutablePointer<UInt8>(0), UInt(size), PROT_READ | PROT_WRITE, MAP_SHARED, fileDescriptor, position)

        }
        if pointer == UnsafePointer<()>(-1) { return .Failure(Error(code: errno)) }
        return .Success(ByteBuffer(order: order, data: UnsafeMutablePointer<UInt8>(pointer), capacity: Int(size), freeOnDeinit: false))
    }
    
    public func unmap(buffer: ByteBuffer) -> Result<Bool> {
        let result = munmap(buffer.data, UInt(buffer.capacity))
        if result < 0 { return .Failure(Error(code: errno)) }
        return .Success(true)
    }
}

        case End
    }
    
    public enum SeekResult {
        case Success(FilePosition)
        case Failure(Error)
        
        public var error: Error? {
            switch self {
            case .Success:
                return nil
            case .Failure(let error):
                return error
                }
        }
        
        public var filePosition: FilePosition! {
            switch self {
            case .Success(let value):
                return value
            case .Failure:
                return nil
                }
        }
    }
    
    public func seek(offset: FileOffset, from: SeekFrom = .Start) -> SeekResult {
        var position: FilePosition
        switch from {
        case .Start:
