1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package org.chromium.mojo.system.impl;
6
7import org.chromium.mojo.system.Handle;
8import org.chromium.mojo.system.MessagePipeHandle;
9
10import java.nio.ByteBuffer;
11import java.util.List;
12
13/**
14 * Implementation of {@link MessagePipeHandle}.
15 */
16class MessagePipeHandleImpl extends HandleBase implements MessagePipeHandle {
17
18    /**
19     * @see HandleBase#HandleBase(CoreImpl, int)
20     */
21    MessagePipeHandleImpl(CoreImpl core, int mojoHandle) {
22        super(core, mojoHandle);
23    }
24
25    /**
26     * @see HandleBase#HandleBase(HandleBase)
27     */
28    MessagePipeHandleImpl(UntypedHandleImpl handle) {
29        super(handle);
30    }
31
32    /**
33     * @see MessagePipeHandle#writeMessage(ByteBuffer, List, WriteFlags)
34     */
35    @Override
36    public void writeMessage(ByteBuffer bytes, List<? extends Handle> handles, WriteFlags flags) {
37        mCore.writeMessage(this, bytes, handles, flags);
38    }
39
40    /**
41     * @see MessagePipeHandle#readMessage(ByteBuffer, int, ReadFlags)
42     */
43    @Override
44    public ReadMessageResult readMessage(ByteBuffer bytes,
45            int maxNumberOfHandles,
46            ReadFlags flags) {
47        return mCore.readMessage(this, bytes, maxNumberOfHandles, flags);
48    }
49
50}
51