Example #1
0
        /*
         * The utility method for reading the whole input stream into a snapshot
         * buffer. To speed up the access it works with an underlying buffer for a
         * given {@link java.io.ByteArrayInputStream}.
         *
         * @param is
         *            the stream to be read.
         * @return the snapshot wrapping the buffer where the bytes are read to.
         * @throws UnsupportedOperationException
         *             if the input stream data cannot be exposed
         */
        public static byte[] expose(java.io.InputStream isJ) // throws IOException,
        {                                                    //UnsupportedOperationException {
            if (isJ is ExposedByteArrayInputStream)
            {
                return(((ExposedByteArrayInputStream)isJ).expose());
            }

            if (isJ.GetType().Equals(typeof(java.io.ByteArrayInputStream)))
            {
                return(expose((java.io.ByteArrayInputStream)isJ));
            }

            // We don't know how to do this
            throw new java.lang.UnsupportedOperationException();
        }