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.
5 package org.chromium.mojo.system;
8 import org.chromium.mojo.system.Core.WaitFlags;
9 import org.chromium.mojo.system.DataPipe.ConsumerHandle;
10 import org.chromium.mojo.system.DataPipe.ProducerHandle;
12 import java.nio.ByteBuffer;
13 import java.util.List;
16 * A handle that will always be invalid.
18 public class InvalidHandle implements UntypedHandle, MessagePipeHandle, ConsumerHandle,
19 ProducerHandle, SharedBufferHandle {
30 * @see Handle#wait(Core.WaitFlags, long)
33 public int wait(WaitFlags flags, long deadline) {
34 throw new MojoException(MojoResult.INVALID_ARGUMENT);
38 * @see Handle#isValid()
41 public boolean isValid() {
46 * @see UntypedHandle#toMessagePipeHandle()
49 public MessagePipeHandle toMessagePipeHandle() {
54 * @see UntypedHandle#toDataPipeConsumerHandle()
57 public ConsumerHandle toDataPipeConsumerHandle() {
62 * @see UntypedHandle#toDataPipeProducerHandle()
65 public ProducerHandle toDataPipeProducerHandle() {
70 * @see UntypedHandle#toSharedBufferHandle()
73 public SharedBufferHandle toSharedBufferHandle() {
78 * @see SharedBufferHandle#duplicate(SharedBufferHandle.DuplicateOptions)
81 public SharedBufferHandle duplicate(DuplicateOptions options) {
82 throw new MojoException(MojoResult.INVALID_ARGUMENT);
86 * @see SharedBufferHandle#map(long, long, SharedBufferHandle.MapFlags)
89 public ByteBuffer map(long offset, long numBytes, MapFlags flags) {
90 throw new MojoException(MojoResult.INVALID_ARGUMENT);
94 * @see SharedBufferHandle#unmap(java.nio.ByteBuffer)
97 public void unmap(ByteBuffer buffer) {
98 throw new MojoException(MojoResult.INVALID_ARGUMENT);
102 * @see DataPipe.ProducerHandle#writeData(java.nio.ByteBuffer, DataPipe.WriteFlags)
105 public int writeData(ByteBuffer elements, DataPipe.WriteFlags flags) {
106 throw new MojoException(MojoResult.INVALID_ARGUMENT);
110 * @see DataPipe.ProducerHandle#beginWriteData(int, DataPipe.WriteFlags)
113 public ByteBuffer beginWriteData(int numBytes,
114 DataPipe.WriteFlags flags) {
115 throw new MojoException(MojoResult.INVALID_ARGUMENT);
119 * @see DataPipe.ProducerHandle#endWriteData(int)
122 public void endWriteData(int numBytesWritten) {
123 throw new MojoException(MojoResult.INVALID_ARGUMENT);
127 * @see DataPipe.ConsumerHandle#discardData(int, DataPipe.ReadFlags)
130 public int discardData(int numBytes, DataPipe.ReadFlags flags) {
131 throw new MojoException(MojoResult.INVALID_ARGUMENT);
135 * @see DataPipe.ConsumerHandle#readData(java.nio.ByteBuffer, DataPipe.ReadFlags)
138 public int readData(ByteBuffer elements, DataPipe.ReadFlags flags) {
139 throw new MojoException(MojoResult.INVALID_ARGUMENT);
143 * @see DataPipe.ConsumerHandle#beginReadData(int, DataPipe.ReadFlags)
146 public ByteBuffer beginReadData(int numBytes,
147 DataPipe.ReadFlags flags) {
148 throw new MojoException(MojoResult.INVALID_ARGUMENT);
152 * @see DataPipe.ConsumerHandle#endReadData(int)
155 public void endReadData(int numBytesRead) {
156 throw new MojoException(MojoResult.INVALID_ARGUMENT);
160 * @see MessagePipeHandle#writeMessage(java.nio.ByteBuffer, java.util.List,
161 * MessagePipeHandle.WriteFlags)
164 public void writeMessage(ByteBuffer bytes, List<Handle> handles, WriteFlags flags) {
165 throw new MojoException(MojoResult.INVALID_ARGUMENT);
169 * @see MessagePipeHandle#readMessage(java.nio.ByteBuffer, int, MessagePipeHandle.ReadFlags)
172 public ReadMessageResult readMessage(ByteBuffer bytes, int maxNumberOfHandles,
174 throw new MojoException(MojoResult.INVALID_ARGUMENT);