LocalStreamConnection.java
Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one
00003  * or more contributor license agreements.  See the NOTICE file
00004  * distributed with this work for additional information
00005  * regarding copyright ownership.  The ASF licenses this file
00006  * to you under the Apache License, Version 2.0 (the
00007  * "License"); you may not use this file except in compliance
00008  * with the License.  You may obtain a copy of the License at
00009  *
00010  *   http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing,
00013  * software distributed under the License is distributed on an
00014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00015  * KIND, either express or implied.  See the License for the
00016  * specific language governing permissions and limitations
00017  * under the License.    
00018  */
00019 package org.apache.xmlrpc.common;
00020 
00021 import java.io.ByteArrayOutputStream;
00022 import java.io.IOException;
00023 import java.io.InputStream;
00024 import java.io.OutputStream;
00025 
00026 
00031 public class LocalStreamConnection {
00032     private class LocalServerStreamConnection implements ServerStreamConnection {
00033         public InputStream newInputStream() throws IOException {
00034             return request;
00035         }
00036 
00037         public OutputStream newOutputStream() throws IOException {
00038             return response;
00039         }
00040 
00041         public void close() throws IOException {
00042             if (response != null) {
00043                 response.close();
00044             }
00045         }
00046     }
00047 
00048     private final InputStream request;
00049         private final XmlRpcStreamRequestConfig config;
00050         private final ByteArrayOutputStream response = new ByteArrayOutputStream();
00051     private final ServerStreamConnection serverStreamConnection;
00052 
00055         public LocalStreamConnection(XmlRpcStreamRequestConfig pConfig, 
00056                         InputStream pRequest) {
00057                 config = pConfig;
00058                 request = pRequest;
00059         serverStreamConnection = new LocalServerStreamConnection();
00060         }
00061 
00064         public InputStream getRequest() {
00065                 return request;
00066         }
00067 
00070         public XmlRpcStreamRequestConfig getConfig() {
00071                 return config;
00072         }
00073 
00077         public ByteArrayOutputStream getResponse() {
00078                 return response;
00079         }
00080 
00083     public ServerStreamConnection getServerStreamConnection() {
00084         return serverStreamConnection;
00085     }
00086 }


rosjava_core
Author(s):
autogenerated on Wed Aug 26 2015 16:06:49