Github user jmuehlner commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-client/pull/16#discussion_r65931141
  
    --- Diff: 
guacamole/src/main/java/org/apache/guacamole/tunnel/InterceptedStream.java ---
    @@ -0,0 +1,161 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +package org.apache.guacamole.tunnel;
    +
    +import java.io.Closeable;
    +import org.apache.guacamole.GuacamoleException;
    +import org.apache.guacamole.protocol.GuacamoleStatus;
    +
    +/**
    + * A simple pairing of the index of an intercepted Guacamole stream with 
the
    + * stream-type object which will produce or consume the data sent over the
    + * intercepted Guacamole stream.
    + *
    + * @author Michael Jumper
    + * @param <T>
    + *     The type of object which will produce or consume the data sent over 
the
    + *     intercepted Guacamole stream. Usually, this will be either 
InputStream
    + *     or OutputStream.
    + */
    +public class InterceptedStream<T extends Closeable> {
    +
    +    /**
    +     * The index of the Guacamole stream being intercepted.
    +     */
    +    private final String index;
    +
    +    /**
    +     * The stream which will produce or consume the data sent over the
    +     * intercepted Guacamole stream.
    +     */
    +    private final T stream;
    +
    +    /**
    +     * The exception which prevented the stream from completing 
successfully,
    +     * if any. If the stream completed successfully, or has not 
encountered any
    +     * exception yet, this will be null.
    +     */
    +    private GuacamoleException streamError = null;
    +
    +    /**
    +     * Creates a new InterceptedStream which associated the given Guacamole
    +     * stream index with the given stream object.
    +     *
    +     * @param index
    +     *     The index of the Guacamole stream being intercepted.
    +     *
    +     * @param stream
    +     *     The stream which will produce or consume the data sent over the
    +     *     intercepted Guacamole stream.
    +     */
    +    public InterceptedStream(String index, T stream) {
    +        this.index = index;
    +        this.stream = stream;
    +    }
    +
    +    /**
    +     * Returns the index of the Guacamole stream being intercepted.
    +     *
    +     * @return
    +     *     The index of the Guacamole stream being intercepted.
    +     */
    +    public String getIndex() {
    +        return index;
    +    }
    +
    +    /**
    +     * Returns the stream which will produce or consume the data sent over 
the
    +     * intercepted Guacamole stream.
    +     *
    +     * @return
    +     *     The stream which will produce or consume the data sent over the
    +     *     intercepted Guacamole stream.
    +     */
    +    public T getStream() {
    +        return stream;
    +    }
    +
    +    /**
    +     * Reports that this InterceptedStream did not complete successfully 
due to
    +     * the given GuacamoleException, which could not be thrown at the time 
due
    +     * to asynchronous handling of the stream contents.
    +     *
    +     * @param streamError
    +     *     The exception which prevented the stream from completing
    +     *     successfully.
    +     */
    +    public void setStreamError(GuacamoleException streamError) {
    +        this.streamError = streamError;
    +    }
    +
    +    /**
    +     * Reports that this InterceptedStream did not complete successfully 
due to
    +     * an error described by the given status code and human-readable 
message.
    +     * The error reported by this call can later be retrieved as a
    +     * GuacamoleStreamException by calling getStreamError().
    --- End diff --
    
    Why not make the returned and stored type that then? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to