// throws IOException,
        /**
         * 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)
        {
            //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();
        }
示例#2
0
 /// <summary>
 /// Create new Array of type with giving length
 /// </summary>
 /// <param name="clazz">type / classe</param>
 /// <param name="length">size of array</param>
 /// <returns></returns>
 public static Object newInstance(java.lang.Class clazz, int length)
 {
     return System.Array.CreateInstance(clazz.GetType(), length);
 }