19439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly/* 29439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * Copyright (c) 2008-2009, Motorola, Inc. 39439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * 49439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * All rights reserved. 59439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * 69439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * Redistribution and use in source and binary forms, with or without 79439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * modification, are permitted provided that the following conditions are met: 89439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * 99439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * - Redistributions of source code must retain the above copyright notice, 109439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * this list of conditions and the following disclaimer. 119439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * 129439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * - Redistributions in binary form must reproduce the above copyright notice, 139439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * this list of conditions and the following disclaimer in the documentation 149439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * and/or other materials provided with the distribution. 159439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * 169439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * - Neither the name of the Motorola, Inc. nor the names of its contributors 179439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * may be used to endorse or promote products derived from this software 189439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * without specific prior written permission. 199439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * 209439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 219439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 229439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 239439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 249439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 259439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 269439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 279439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 289439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 299439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 309439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * POSSIBILITY OF SUCH DAMAGE. 319439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly */ 329439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly 339439a7fe517b858bc5e5c654b459315e4722feb2Nick Pellypackage javax.obex; 349439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly 352e0da96e757a977154063f980d3f4e1abd41cf09Nick Pellyimport java.io.IOException; 369439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly 379439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly/** 389439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * This interface defines the methods needed by a parent that uses the 399439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * PrivateInputStream and PrivateOutputStream objects defined in this package. 402e0da96e757a977154063f980d3f4e1abd41cf09Nick Pelly * @hide 419439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly */ 429439a7fe517b858bc5e5c654b459315e4722feb2Nick Pellypublic interface BaseStream { 439439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly 449439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly /** 459439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * Verifies that this object is still open. 462e0da96e757a977154063f980d3f4e1abd41cf09Nick Pelly * @throws IOException if the object is closed 479439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly */ 483998bf009acaf8cde4d7f837f8b8e41ae0a65141Tao Liejun void ensureOpen() throws IOException; 499439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly 509439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly /** 5105ff98bbefda39b9ff26f8bca132cfd0248745c6Tao Liejun * Verifies that additional information may be sent. In other words, the 529439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * operation is not done. 532e0da96e757a977154063f980d3f4e1abd41cf09Nick Pelly * @throws IOException if the operation is completed 549439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly */ 553998bf009acaf8cde4d7f837f8b8e41ae0a65141Tao Liejun void ensureNotDone() throws IOException; 569439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly 579439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly /** 589439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * Continues the operation since there is no data to read. 5905ff98bbefda39b9ff26f8bca132cfd0248745c6Tao Liejun * @param sendEmpty <code>true</code> if the operation should send an empty 6005ff98bbefda39b9ff26f8bca132cfd0248745c6Tao Liejun * packet or not send anything if there is no data to send 6105ff98bbefda39b9ff26f8bca132cfd0248745c6Tao Liejun * @param inStream <code>true</code> if the stream is input stream or is 6205ff98bbefda39b9ff26f8bca132cfd0248745c6Tao Liejun * output stream 639439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * @return <code>true</code> if the operation was completed; 6405ff98bbefda39b9ff26f8bca132cfd0248745c6Tao Liejun * <code>false</code> if no operation took place 652e0da96e757a977154063f980d3f4e1abd41cf09Nick Pelly * @throws IOException if an IO error occurs 669439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly */ 673998bf009acaf8cde4d7f837f8b8e41ae0a65141Tao Liejun boolean continueOperation(boolean sendEmpty, boolean inStream) throws IOException; 689439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly 699439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly /** 709439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * Called when the output or input stream is closed. 719439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly * @param inStream <code>true</code> if the input stream is closed; 7205ff98bbefda39b9ff26f8bca132cfd0248745c6Tao Liejun * <code>false</code> if the output stream is closed 732e0da96e757a977154063f980d3f4e1abd41cf09Nick Pelly * @throws IOException if an IO error occurs 749439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly */ 753998bf009acaf8cde4d7f837f8b8e41ae0a65141Tao Liejun void streamClosed(boolean inStream) throws IOException; 769439a7fe517b858bc5e5c654b459315e4722feb2Nick Pelly} 77