コード例 #1
0
 /// <summary>
 /// Synonym for opening the given resource and calling
 /// <see cref="decodeResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, Rect, Options)
 ///     ">decodeResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, Rect, Options)
 ///     </see>
 /// .
 /// </summary>
 /// <param name="res">The resources object containing the image data</param>
 /// <param name="id">The resource id of the image data</param>
 /// <param name="opts">
 /// null-ok; Options that control downsampling and whether the
 /// image should be completely decoded, or just is size returned.
 /// </param>
 /// <returns>
 /// The decoded bitmap, or null if the image data could not be
 /// decoded, or, if opts is non-null, if opts requested only the
 /// size be returned (in opts.outWidth and opts.outHeight)
 /// </returns>
 public static android.graphics.Bitmap decodeResource(android.content.res.Resources
                                                      res, int id, android.graphics.BitmapFactory.Options opts)
 {
     android.graphics.Bitmap bm  = null;
     java.io.InputStream     @is = null;
     try
     {
         android.util.TypedValue value = new android.util.TypedValue();
         @is = res.openRawResource(id, value);
         bm  = decodeResourceStream(res, value, @is, null, opts);
     }
     catch (System.Exception)
     {
     }
     finally
     {
         try
         {
             if (@is != null)
             {
                 @is.close();
             }
         }
         catch (System.IO.IOException)
         {
         }
     }
     // Ignore
     if (bm == null && opts != null && opts.inBitmap != null)
     {
         throw new System.ArgumentException("Problem decoding into existing bitmap");
     }
     return(bm);
 }
コード例 #2
0
        /// <summary>
        /// Releases the unmanaged resources used by this
        /// <see cref="System.IO.Stream"/> and optionally
        /// releases the managed resources.
        /// </summary>
        /// <remarks>
        /// Calling this method with <c>true</c> effectively
        /// closes and nullifies this object's underlying
        /// java.io.InputStream.  However, calling Close()
        /// is the preferred method.
        /// </remarks>
        /// <param name="disposing">
        /// True to release both managed and unmanaged resources;
        /// false to release only unmanaged resources.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                lock (this)
                {
                    try
                    {
                        if (m_in != null)
                        {
                            m_in.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        throw new IOException(ex.ToString(), ex);
                    }
                    finally
                    {
                        m_in = null;

                        base.Dispose(disposing);
                    }
                }
            }
            else
            {
                base.Dispose(disposing);
            }
        }
コード例 #3
0
 public virtual ArangoDB.Builder loadProperties(java.io.InputStream @in
                                                )
 {
     if (@in != null)
     {
         java.util.Properties properties = new java.util.Properties();
         try
         {
             properties.load(@in);
             host = getProperty(properties, PROPERTY_KEY_HOST, host, ArangoDBConstants
                                .DEFAULT_HOST);
             port = System.Convert.ToInt32(getProperty(properties, PROPERTY_KEY_PORT, port, ArangoDBConstants
                                                       .DEFAULT_PORT));
             timeout = System.Convert.ToInt32(getProperty(properties, PROPERTY_KEY_TIMEOUT, timeout
                                                          , ArangoDBConstants.DEFAULT_TIMEOUT));
             user     = getProperty(properties, PROPERTY_KEY_USER, user, null);
             password = getProperty(properties, PROPERTY_KEY_PASSWORD, password, null);
             useSsl   = bool.parseBoolean(getProperty(properties, PROPERTY_KEY_USE_SSL, useSsl,
                                                      ArangoDBConstants.DEFAULT_USE_SSL));
             chunksize = System.Convert.ToInt32(getProperty(properties, PROPERTY_KEY_V_STREAM_CHUNK_CONTENT_SIZE
                                                            , chunksize, ArangoDBConstants.CHUNK_DEFAULT_CONTENT_SIZE
                                                            ));
         }
         catch (System.IO.IOException e)
         {
             throw new ArangoDBException(e);
         }
     }
     return(this);
 }
コード例 #4
0
ファイル: CapabilitiesLoader.cs プロジェクト: yonder/mono
        static TextReader GetJavaTextReader(string filename)
        {
            try
            {
                java.lang.ClassLoader cl = (java.lang.ClassLoader)
                                           AppDomain.CurrentDomain.GetData("GH_ContextClassLoader");
                if (cl == null)
                {
                    return(null);
                }

                string custom = String.Concat("browscap/", filename);

                java.io.InputStream inputStream = cl.getResourceAsStream(custom);
                if (inputStream == null)
                {
                    inputStream = cl.getResourceAsStream(filename);
                }

                if (inputStream == null)
                {
                    return(null);
                }

                return(new StreamReader(new System.Web.J2EE.J2EEUtils.InputStreamWrapper(inputStream)));
            }
            catch (Exception e)
            {
                return(null);
            }
        }
コード例 #5
0
        /// <summary>
        /// Returns the ASCII characters up to but not including the next "\r\n", or
        /// "\n".
        /// </summary>
        /// <remarks>
        /// Returns the ASCII characters up to but not including the next "\r\n", or
        /// "\n".
        /// </remarks>
        /// <exception cref="java.io.EOFException">
        /// if the stream is exhausted before the next newline
        /// character.
        /// </exception>
        /// <exception cref="System.IO.IOException"></exception>
        public static string readAsciiLine(java.io.InputStream @in)
        {
            // TODO: support UTF-8 here instead
            java.lang.StringBuilder result = new java.lang.StringBuilder(80);
            while (true)
            {
                int c = @in.read();
                if (c == -1)
                {
                    throw new java.io.EOFException();
                }
                else
                {
                    if (c == '\n')
                    {
                        break;
                    }
                }
                result.append((char)c);
            }
            int length = result.Length;

            if (length > 0 && result[length - 1] == '\r')
            {
                result.setLength(length - 1);
            }
            return(result.ToString());
        }
コード例 #6
0
 /// <summary>
 /// Reads exactly 'byteCount' bytes from 'in' (into 'dst' at offset 'offset'), and throws
 /// EOFException if insufficient bytes are available.
 /// </summary>
 /// <remarks>
 /// Reads exactly 'byteCount' bytes from 'in' (into 'dst' at offset 'offset'), and throws
 /// EOFException if insufficient bytes are available.
 /// Used to implement
 /// <see cref="java.io.DataInputStream.readFully(byte[], int, int)">java.io.DataInputStream.readFully(byte[], int, int)
 ///     </see>
 /// .
 /// </remarks>
 /// <exception cref="System.IO.IOException"></exception>
 public static void readFully(java.io.InputStream @in, byte[] dst, int offset, int
                              byteCount)
 {
     if (byteCount == 0)
     {
         return;
     }
     if (@in == null)
     {
         throw new System.ArgumentNullException("in == null");
     }
     if (dst == null)
     {
         throw new System.ArgumentNullException("dst == null");
     }
     java.util.Arrays.checkOffsetAndCount(dst.Length, offset, byteCount);
     while (byteCount > 0)
     {
         int bytesRead = @in.read(dst, offset, byteCount);
         if (bytesRead < 0)
         {
             throw new java.io.EOFException();
         }
         offset    += bytesRead;
         byteCount -= bytesRead;
     }
 }
コード例 #7
0
        /// <summary>
        /// Call
        /// <code>in.read()</code>
        /// repeatedly until either the stream is exhausted or
        /// <code>byteCount</code>
        /// bytes have been read.
        /// <p>This method reuses the skip buffer but is careful to never use it at
        /// the same time that another stream is using it. Otherwise streams that use
        /// the caller's buffer for consistency checks like CRC could be clobbered by
        /// other threads. A thread-local buffer is also insufficient because some
        /// streams may call other streams in their skip() method, also clobbering the
        /// buffer.
        /// </summary>
        /// <exception cref="System.IO.IOException"></exception>
        public static long skipByReading(java.io.InputStream @in, long byteCount)
        {
            // acquire the shared skip buffer.
            byte[] buffer = skipBuffer.getAndSet(null);
            if (buffer == null)
            {
                buffer = new byte[4096];
            }
            long skipped = 0;

            while (skipped < byteCount)
            {
                int toRead = (int)System.Math.Min(byteCount - skipped, buffer.Length);
                int read   = @in.read(buffer, 0, toRead);
                if (read == -1)
                {
                    break;
                }
                skipped += read;
                if (read < toRead)
                {
                    break;
                }
            }
            // release the shared skip buffer.
            skipBuffer.set(buffer);
            return(skipped);
        }
コード例 #8
0
        /// <summary>Implements InputStream.read(int) in terms of InputStream.read(byte[], int, int).
        ///     </summary>
        /// <remarks>
        /// Implements InputStream.read(int) in terms of InputStream.read(byte[], int, int).
        /// InputStream assumes that you implement InputStream.read(int) and provides default
        /// implementations of the others, but often the opposite is more efficient.
        /// </remarks>
        /// <exception cref="System.IO.IOException"></exception>
        public static int readSingleByte(java.io.InputStream @in)
        {
            byte[] buffer = new byte[1];
            int    result = @in.read(buffer, 0, 1);

            return((result != -1) ? buffer[0] & unchecked ((int)(0xff)) : -1);
        }
コード例 #9
0
 /// <exception cref="System.IO.IOException"></exception>
 public static void skipAll(java.io.InputStream @in)
 {
     do
     {
         @in.skip(long.MaxValue);
     }while (@in.read() != -1);
 }
コード例 #10
0
 public static void CopyEntries(ZipFile from, ZipOutputStream to, FilterEntryMethod filter)
 {
     foreach (ZipEntry entry in new EnumerationAdapter(new EnumerationMethod(from.entries)))
     {
         if (filter == null || filter(entry))
         {
             java.io.InputStream s = from.getInputStream(entry);
             try
             {
                 to.putNextEntry(entry);
                 try
                 {
                     CopyStream(s, to);
                 }
                 finally
                 {
                     to.closeEntry();
                 }
             }
             finally
             {
                 s.close();
             }
         }
     }
 }
コード例 #11
0
 public override int read()
 {
     lock (this)
     {
         // Use local refs since buf and in may be invalidated by an
         // unsynchronized close()
         byte[] localBuf             = buf;
         java.io.InputStream localIn = @in;
         if (localBuf == null || localIn == null)
         {
             throw streamClosed();
         }
         if (pos >= count && fillbuf(localIn, localBuf) == -1)
         {
             return(-1);
         }
         // localBuf may have been invalidated by fillbuf
         if (localBuf != buf)
         {
             localBuf = buf;
             if (localBuf == null)
             {
                 throw streamClosed();
             }
         }
         if (count - pos > 0)
         {
             return(localBuf[pos++] & unchecked ((int)(0xFF)));
         }
         return(-1);
     }
 }
コード例 #12
0
        /// <summary>
        /// Reads the zip stream.
        /// </summary>
        /// <param name="jInputStream">The j input stream.</param>
        /// <param name="callback">The callback.</param>
        /// <param name="rock">The rock.</param>
        public static void ReadZipStream(java.io.InputStream jInputStream, CallbackZip callback, object rock)
        {
            ZipInputStream zis = null;

            try
            {
                zis = new ZipInputStream(jInputStream);

                ZipEntry  entry;
                ZipEntryE extendedEntry;
                while ((entry = zis.getNextEntry()) != null)
                {
                    extendedEntry = new ZipEntryE(entry);
                    callback(extendedEntry, new ZipEntryInputStream(zis), rock);

                    // Close the entry that we read
                    zis.closeEntry();
                }
            }
            finally
            {
                if (zis != null)
                {
                    zis.close();
                }
            }
        }
コード例 #13
0
ファイル: BitmapDrawable.cs プロジェクト: zhouweiaccp/XobotOS
 public BitmapDrawable(java.io.InputStream @is) : this(new android.graphics.drawable.BitmapDrawable
                                                       .BitmapState(android.graphics.BitmapFactory.decodeStream(@is)), null)
 {
     if (mBitmap == null)
     {
         android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + @is);
     }
 }
コード例 #14
0
 /// <summary>
 /// Constructs a new
 /// <code>BufferedInputStream</code>
 /// , providing
 /// <code>in</code>
 /// with
 /// <code>size</code>
 /// bytes
 /// of buffer.
 /// <p><strong>Warning:</strong> passing a null source creates a closed
 /// <code>BufferedInputStream</code>
 /// . All read operations on such a stream will
 /// fail with an IOException.
 /// </summary>
 /// <param name="in">
 /// the
 /// <code>InputStream</code>
 /// the buffer reads from.
 /// </param>
 /// <param name="size">the size of buffer in bytes.</param>
 /// <exception cref="System.ArgumentException">
 /// if
 /// <code>size &lt;= 0</code>
 /// .
 /// </exception>
 public BufferedInputStream(java.io.InputStream @in, int size) : base(@in)
 {
     if (size <= 0)
     {
         throw new System.ArgumentException("size <= 0");
     }
     buf = new byte[size];
 }
コード例 #15
0
ファイル: RuleBase.cs プロジェクト: soboE2/SEP
 public void Load(Stream stream)
 {
     //FileInputStream stream = new FileInputStream(filePath);
     java.io.InputStream _javaStream = DroolsDotnetUtil.getJavaInputStreamFromSystemStream(stream);
     java.io.ObjectInput objInp      = new java.io.ObjectInputStream(_javaStream);
     ((ReteooRuleBase)this._javaRuleBase).readExternal(objInp);
     _javaStream.close();
 }
コード例 #16
0
 /// <summary>
 /// Constructs a new InputStreamReader on the InputStream
 /// <code>in</code>
 /// and
 /// CharsetDecoder
 /// <code>dec</code>
 /// .
 /// </summary>
 /// <param name="in">the source InputStream from which to read characters.</param>
 /// <param name="dec">the CharsetDecoder used by the character conversion.</param>
 public InputStreamReader(java.io.InputStream @in, java.nio.charset.CharsetDecoder
                          dec) : base(@in)
 {
     dec.averageCharsPerByte();
     this.@in = @in;
     decoder  = dec;
     bytes.limit(0);
 }
コード例 #17
0
 /// <summary>
 /// Constructs a new InputStreamReader on the InputStream
 /// <code>in</code>
 /// and
 /// Charset
 /// <code>charset</code>
 /// .
 /// </summary>
 /// <param name="in">the source InputStream from which to read characters.</param>
 /// <param name="charset">the Charset that defines the character converter</param>
 public InputStreamReader(java.io.InputStream @in, java.nio.charset.Charset charset
                          ) : base(@in)
 {
     this.@in = @in;
     decoder  = charset.newDecoder().onMalformedInput(java.nio.charset.CodingErrorAction
                                                      .REPLACE).onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPLACE);
     bytes.limit(0);
 }
コード例 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JInputStream"/> class.
 /// </summary>
 /// <param name="javaInputStream">The java input stream.</param>
 public JInputStream(java.io.InputStream javaInputStream)
 {
     if (javaInputStream == null)
     {
         throw new ArgumentNullException("javaInputStream");
     }
     m_jis = javaInputStream;
 }
コード例 #19
0
ファイル: InputStreamReader.cs プロジェクト: hakeemsm/XobotOS
		/// <summary>
		/// Constructs a new InputStreamReader on the InputStream
		/// <code>in</code>
		/// and
		/// CharsetDecoder
		/// <code>dec</code>
		/// .
		/// </summary>
		/// <param name="in">the source InputStream from which to read characters.</param>
		/// <param name="dec">the CharsetDecoder used by the character conversion.</param>
		public InputStreamReader(java.io.InputStream @in, java.nio.charset.CharsetDecoder
			 dec) : base(@in)
		{
			dec.averageCharsPerByte();
			this.@in = @in;
			decoder = dec;
			bytes.limit(0);
		}
コード例 #20
0
ファイル: InputStreamReader.cs プロジェクト: hakeemsm/XobotOS
		/// <summary>
		/// Constructs a new InputStreamReader on the InputStream
		/// <code>in</code>
		/// and
		/// Charset
		/// <code>charset</code>
		/// .
		/// </summary>
		/// <param name="in">the source InputStream from which to read characters.</param>
		/// <param name="charset">the Charset that defines the character converter</param>
		public InputStreamReader(java.io.InputStream @in, java.nio.charset.Charset charset
			) : base(@in)
		{
			this.@in = @in;
			decoder = charset.newDecoder().onMalformedInput(java.nio.charset.CodingErrorAction
				.REPLACE).onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPLACE);
			bytes.limit(0);
		}
コード例 #21
0
 /// <summary>
 /// Constructs a new
 /// <code>PushbackInputStream</code>
 /// with
 /// <code>in</code>
 /// as source
 /// input stream. The size of the pushback buffer is set to
 /// <code>size</code>
 /// .
 /// <p><strong>Warning:</strong> passing a null source creates an invalid
 /// <code>PushbackInputStream</code>
 /// . All read operations on such a stream will
 /// fail.
 /// </summary>
 /// <param name="in">the source input stream.</param>
 /// <param name="size">the size of the pushback buffer.</param>
 /// <exception cref="System.ArgumentException">
 /// if
 /// <code>size</code>
 /// is negative.
 /// </exception>
 public PushbackInputStream(java.io.InputStream @in, int size) : base(@in)
 {
     if (size <= 0)
     {
         throw new System.ArgumentException("size <= 0");
     }
     buf = (@in == null) ? null : new byte[size];
     pos = size;
 }
コード例 #22
0
        public JavaInputStreamWrapper(java.io.InputStream inputStream)
        {
            if (inputStream == null)
            {
                throw new ArgumentNullException("inputStream");
            }

            m_in = inputStream;
        }
コード例 #23
0
        public JavaInputStreamWrapper(java.io.InputStream inputStream)
        {
            if (inputStream == null)
            {
                throw new ArgumentNullException("inputStream");
            }

            m_in = inputStream;
        }
コード例 #24
0
 public virtual void TestSerializePolyline()
 {
     try
     {
         java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream    oo        = new java.io.ObjectOutputStream(streamOut);
         com.epl.geometry.Polyline     pt        = new com.epl.geometry.Polyline();
         pt.StartPath(10, 10);
         pt.LineTo(100, 100);
         pt.LineTo(200, 100);
         oo.WriteObject(pt);
         System.IO.BinaryWriter    streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray());
         java.io.ObjectInputStream ii       = new java.io.ObjectInputStream(streamIn);
         com.epl.geometry.Polyline ptRes    = (com.epl.geometry.Polyline)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         Fail("Polyline serialization failure");
     }
     //try
     //{
     //FileOutputStream streamOut = new FileOutputStream("c:/temp/savedPolyline1.txt");
     //ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     //Polyline pt = new Polyline();
     //pt.startPath(10, 10);
     //pt.lineTo(100, 100);
     //pt.lineTo(200, 100);
     //oo.writeObject(pt);
     //}
     //catch(Exception ex)
     //{
     //fail("Polyline serialization failure");
     //}
     try
     {
         java.io.InputStream       s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedPolyline.txt");
         java.io.ObjectInputStream ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.Polyline ptRes = (com.epl.geometry.Polyline)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes != null);
     }
     catch (System.Exception)
     {
         Fail("Polyline serialization failure");
     }
     try
     {
         java.io.InputStream       s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedPolyline1.txt");
         java.io.ObjectInputStream ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.Polyline ptRes = (com.epl.geometry.Polyline)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes != null);
     }
     catch (System.Exception)
     {
         Fail("Polyline serialization failure");
     }
 }
コード例 #25
0
 private Socket(rtl.SOCKET handle)
         #endif
 {
     fHandle = handle;
                 #if cooper
     fSocketInput  = fHandle.getInputStream();
     fSocketOutput = fHandle.getOutputStream();
                 #endif
 }
コード例 #26
0
        public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
                                     parser, android.util.AttributeSet attrs)
        {
            base.inflate(r, parser, attrs);
            android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
                                                                  styleable.NinePatchDrawable);
            int id = a.getResourceId([email protected]_src, 0);

            if (id == 0)
            {
                throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
                                                                ": <nine-patch> requires a valid src attribute");
            }
            bool dither = a.getBoolean([email protected]_dither
                                       , DEFAULT_DITHER);

            android.graphics.BitmapFactory.Options options = new android.graphics.BitmapFactory
                                                             .Options();
            if (dither)
            {
                options.inDither = false;
            }
            options.inScreenDensity = android.util.DisplayMetrics.DENSITY_DEVICE;
            android.graphics.Rect   padding = new android.graphics.Rect();
            android.graphics.Bitmap bitmap  = null;
            try
            {
                android.util.TypedValue value = new android.util.TypedValue();
                java.io.InputStream     @is   = r.openRawResource(id, value);
                bitmap = android.graphics.BitmapFactory.decodeResourceStream(r, value, @is, padding
                                                                             , options);
                @is.close();
            }
            catch (System.IO.IOException)
            {
            }
            // Ignore
            if (bitmap == null)
            {
                throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
                                                                ": <nine-patch> requires a valid src attribute");
            }
            else
            {
                if (bitmap.getNinePatchChunk() == null)
                {
                    throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
                                                                    ": <nine-patch> requires a valid 9-patch source image");
                }
            }
            setNinePatchState(new android.graphics.drawable.NinePatchDrawable.NinePatchState(
                                  new android.graphics.NinePatch(bitmap, bitmap.getNinePatchChunk(), "XML 9-patch"
                                                                 ), padding, dither), r);
            mNinePatchState.mTargetDensity = mTargetDensity;
            a.recycle();
        }
コード例 #27
0
        /// <summary>
        /// CopyStream
        /// </summary>

        public static void CopyStream(java.io.InputStream from, java.io.OutputStream to)
        {
            sbyte[] buffer = new sbyte[8192];
            int     got;

            while ((got = from.read(buffer, 0, buffer.Length)) > 0)
            {
                to.write(buffer, 0, got);
            }
        }
コード例 #28
0
 public override void close()
 {
     buf = null;
     java.io.InputStream localIn = @in;
     @in = null;
     if (localIn != null)
     {
         localIn.close();
     }
 }
コード例 #29
0
ファイル: BitmapDrawable.cs プロジェクト: zhouweiaccp/XobotOS
 /// <summary>Create a drawable by decoding a bitmap from the given input stream.</summary>
 /// <remarks>Create a drawable by decoding a bitmap from the given input stream.</remarks>
 public BitmapDrawable(android.content.res.Resources res, java.io.InputStream @is)
     : this(new android.graphics.drawable.BitmapDrawable.BitmapState(android.graphics.BitmapFactory
                                                                     .decodeStream(@is)), null)
 {
     mBitmapState.mTargetDensity = mTargetDensity;
     if (mBitmap == null)
     {
         android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + @is);
     }
 }
コード例 #30
0
 public virtual void TestSerializeMultiPoint()
 {
     try
     {
         java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream    oo        = new java.io.ObjectOutputStream(streamOut);
         com.epl.geometry.MultiPoint   pt        = new com.epl.geometry.MultiPoint();
         pt.Add(10, 30);
         pt.Add(120, 40);
         oo.WriteObject(pt);
         System.IO.BinaryWriter      streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray());
         java.io.ObjectInputStream   ii       = new java.io.ObjectInputStream(streamIn);
         com.epl.geometry.MultiPoint ptRes    = (com.epl.geometry.MultiPoint)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         Fail("MultiPoint serialization failure");
     }
     //try
     //{
     //FileOutputStream streamOut = new FileOutputStream("c:/temp/savedMultiPoint1.txt");
     //ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     //MultiPoint pt = new MultiPoint();
     //pt.add(10, 30);
     //pt.add(120, 40);
     //oo.writeObject(pt);
     //}
     //catch(Exception ex)
     //{
     //fail("MultiPoint serialization failure");
     //}
     try
     {
         java.io.InputStream         s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedMultiPoint.txt");
         java.io.ObjectInputStream   ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.MultiPoint ptRes = (com.epl.geometry.MultiPoint)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.GetPoint(1).GetY() == 40);
     }
     catch (System.Exception)
     {
         Fail("MultiPoint serialization failure");
     }
     try
     {
         java.io.InputStream         s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedMultiPoint1.txt");
         java.io.ObjectInputStream   ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.MultiPoint ptRes = (com.epl.geometry.MultiPoint)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.GetPoint(1).GetY() == 40);
     }
     catch (System.Exception)
     {
         Fail("MultiPoint serialization failure");
     }
 }
コード例 #31
0
 /// <summary>Returns a byte[] containing the remainder of 'in', closing it when done.
 ///     </summary>
 /// <remarks>Returns a byte[] containing the remainder of 'in', closing it when done.
 ///     </remarks>
 /// <exception cref="System.IO.IOException"></exception>
 public static byte[] readFully(java.io.InputStream @in)
 {
     try
     {
         return(readFullyNoClose(@in));
     }
     finally
     {
         @in.close();
     }
 }
コード例 #32
0
ファイル: XmlPullParser.cs プロジェクト: zffl/androidmono
 void org.xmlpull.v1.XmlPullParser.setInput(java.io.InputStream arg0, java.lang.String arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::org.xmlpull.v1.XmlPullParser_._setInput16560, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::org.xmlpull.v1.XmlPullParser_.staticClass, global::org.xmlpull.v1.XmlPullParser_._setInput16560, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
コード例 #33
0
 public override void engineLoad(java.io.InputStream arg0, char[] arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::java.security.KeyStoreSpi_._engineLoad14847, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::java.security.KeyStoreSpi_.staticClass, global::java.security.KeyStoreSpi_._engineLoad14847, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
コード例 #34
0
ファイル: Archiver.cs プロジェクト: Yitzchok/PublicDomain
 /// <summary>
 /// Initializes a new instance of the <see cref="JInputStream"/> class.
 /// </summary>
 /// <param name="javaInputStream">The java input stream.</param>
 public JInputStream(java.io.InputStream javaInputStream)
 {
     if (javaInputStream == null)
     {
         throw new ArgumentNullException("javaInputStream");
     }
     m_jis = javaInputStream;
 }
コード例 #35
0
 /// <summary>
 /// Constructs an audio input stream that reads its data from the target
 /// data line indicated.
 /// </summary>
 /// <remarks>
 /// Constructs an audio input stream that reads its data from the target
 /// data line indicated.  The format of the stream is the same as that of
 /// the target data line, and the length is AudioSystem#NOT_SPECIFIED.
 /// </remarks>
 /// <param name="line">the target data line from which this stream obtains its data.</param>
 /// <seealso cref="AudioSystem.NOT_SPECIFIED">AudioSystem.NOT_SPECIFIED</seealso>
 public AudioInputStream(TargetDataLine line)
 {
     AudioInputStream.TargetDataLineInputStream tstream = new AudioInputStream.TargetDataLineInputStream
         (this, line);
     format = line.getFormat();
     frameLength = AudioSystem.NOT_SPECIFIED;
     frameSize = format.getFrameSize();
     if (frameSize == AudioSystem.NOT_SPECIFIED || frameSize <= 0)
     {
         frameSize = 1;
     }
     this.stream = tstream;
     framePos = 0;
     markpos = 0;
 }
コード例 #36
0
 /// <summary>
 /// Creates a <code>FilteredAudioInputStream</code> with the specified buffer
 /// size, and saves its argument, the inputstream <code>in</code> for later use.
 /// </summary>
 /// <remarks>
 /// Creates a <code>FilteredAudioInputStream</code> with the specified buffer
 /// size, and saves its argument, the inputstream <code>in</code> for later use.
 /// An internal buffer array of length <code>size</code> is created and stored
 /// in <code>buf</code>.
 /// </remarks>
 /// <param name="in">the underlying input stream.</param>
 /// <param name="format">the format of this stream's audio data.</param>
 /// <param name="length">the length in sample frames of the data in this stream.</param>
 /// <param name="size">the buffer size.</param>
 /// <param name="presize">the prebuffer size.</param>
 /// <exception>
 /// IllegalArgumentException
 /// if size &lt;= 0 or presize &lt;= 0.
 /// </exception>
 public FilteredAudioInputStream(java.io.InputStream @in, javax.sound.sampled.AudioFormat
     format, long length, int size, int presize)
     : base(@in, format, length)
 {
     this.@in = @in;
     if ((size <= 0) || (presize <= 0))
     {
         throw new System.ArgumentException("Buffer size <= 0");
     }
     buf = new byte[size];
     count = 0;
     prebuf = new byte[presize];
     precount = 0;
     marklimit = size;
     markpos = -1;
 }
コード例 #37
0
ファイル: vfs.cs プロジェクト: jira-sarec/ICSE-2012-TraceLab
			internal ZipEntryStream(java.util.zip.ZipFile zipFile, java.util.zip.ZipEntry entry)
			{
				this.zipFile = zipFile;
				this.entry = entry;
				inp = zipFile.getInputStream(entry);
			}
コード例 #38
0
 /// <summary>
 /// Constructs an audio input stream that has the requested format and length in sample frames,
 /// using audio data from the specified input stream.
 /// </summary>
 /// <remarks>
 /// Constructs an audio input stream that has the requested format and length in sample frames,
 /// using audio data from the specified input stream.
 /// </remarks>
 /// <param name="stream">
 /// the stream on which this <code>AudioInputStream</code>
 /// object is based
 /// </param>
 /// <param name="format">the format of this stream's audio data</param>
 /// <param name="length">the length in sample frames of the data in this stream</param>
 public AudioInputStream(java.io.InputStream stream, AudioFormat format, 
     long length)
     : base()
 {
     this.format = format;
     this.frameLength = length;
     this.frameSize = format.getFrameSize();
     // any frameSize that is not well-defined will
     // cause that this stream will be read in bytes
     if (this.frameSize == AudioSystem.NOT_SPECIFIED || frameSize <= 0)
     {
         this.frameSize = 1;
     }
     this.stream = stream;
     framePos = 0;
     markpos = 0;
 }
コード例 #39
0
        /// <summary>
        /// Releases the unmanaged resources used by this
        /// <see cref="System.IO.Stream"/> and optionally
        /// releases the managed resources.
        /// </summary>
        /// <remarks>
        /// Calling this method with <c>true</c> effectively
        /// closes and nullifies this object's underlying
        /// java.io.InputStream.  However, calling Close()
        /// is the preferred method.
        /// </remarks>
        /// <param name="disposing">
        /// True to release both managed and unmanaged resources;
        /// false to release only unmanaged resources.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                lock (this)
                {
                    try
                    {
                        if (m_in != null)
                        {
                            m_in.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        throw new IOException(ex.ToString(), ex);
                    }
                    finally
                    {
                        m_in = null;

                        base.Dispose(disposing);
                    }
                }
            }
            else
            {
                base.Dispose(disposing);
            }
        }
コード例 #40
0
 /// <summary>
 /// Closes this input stream and releases any system resources associated with
 /// the stream.
 /// </summary>
 /// <remarks>
 /// Closes this input stream and releases any system resources associated with
 /// the stream.
 /// </remarks>
 /// <exception>
 /// IOException
 /// if an I/O error occurs.
 /// </exception>
 /// <exception cref="System.IO.IOException"></exception>
 public override void close()
 {
     lock (this)
     {
         if (@in == null)
         {
             return;
         }
         @in.close();
         @in = null;
         buf = null;
         prebuf = null;
     }
 }
コード例 #41
0
 private void StartInstanceBlocked()
 {
     if (interpreter == null)
     {
         if (UseStreams)
         {
             outStream = getOutputStream();
             inStream = getInputStream();
             interpreter = Interpreter.createJLispInstance(inStream, outStream, ".", VersionString);
             return;
         }
         interpreter = Interpreter.createDefaultInstance(new String[0]);
     }
 }
コード例 #42
0
ファイル: InputStreamReader.cs プロジェクト: hakeemsm/XobotOS
		public override void close()
		{
			lock (@lock)
			{
				if (decoder != null)
				{
					decoder.reset();
				}
				decoder = null;
				if (@in != null)
				{
					@in.close();
					@in = null;
				}
			}
		}
コード例 #43
0
ファイル: J2EEUtils.cs プロジェクト: carrie901/mono
		public StreamGobbler(java.io.InputStream ins, String type)
		{
			this._is = ins;
			this._type = type;
		}
コード例 #44
0
ファイル: J2EEUtils.cs プロジェクト: carrie901/mono
			public InputStreamWrapper (java.io.InputStream ins) {
				_ins = ins;
			}
コード例 #45
0
ファイル: FilterInputStream.cs プロジェクト: hakeemsm/XobotOS
		/// <summary>
		/// Constructs a new
		/// <code>FilterInputStream</code>
		/// with the specified input
		/// stream as source.
		/// <p><strong>Warning:</strong> passing a null source creates an invalid
		/// <code>FilterInputStream</code>
		/// , that fails on every method that is not
		/// overridden. Subclasses should check for null in their constructors.
		/// </summary>
		/// <param name="in">the input stream to filter reads on.</param>
		protected internal FilterInputStream(java.io.InputStream @in)
		{
			this.@in = @in;
		}