1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 package javax.resource.cci; 24 25 26 import java.io.InputStream; 27 import java.io.OutputStream; 28 import java.io.IOException; 29 30 /** Streamable interface enables a resource adapter to extract data from 31 * an input Record or set data into an output Record as a stream of 32 * bytes. 33 * 34 * <p>The Streamable interface provides a resource adapter's view 35 * of the data that has been set in a Record instance by a component. 36 * 37 * <p>The Streamable interface is not directly used by a component. It 38 * is used by a resource adapter implementation. A component uses Record 39 * or any derived interfaces to manage records. 40 * 41 * @author Rahul Sharma 42 * @since 0.8 43 * @see javax.resource.cci.Record 44 **/ 45 46 public interface Streamable { 47 48 /** Read data from an InputStream and initialize fields of a 49 * Streamable object. 50 * 51 * @param istream InputStream that represents a resource 52 * adapter specific internal representation 53 * of fields of a Streamable object 54 **/ 55 public 56 void read(InputStream istream) throws IOException; 57 58 59 /** Write fields of a Streamable object to an OutputStream 60 * @param ostream OutputStream that holds value of a 61 * Streamable object 62 **/ 63 public 64 void write(OutputStream ostream) throws IOException; 65 66 } 67 68