当前位置: 首页>>代码示例>>C#>>正文


C# biz.ritter.javapi.read方法代码示例

本文整理汇总了C#中biz.ritter.javapi.read方法的典型用法代码示例。如果您正苦于以下问题:C# biz.ritter.javapi.read方法的具体用法?C# biz.ritter.javapi.read怎么用?C# biz.ritter.javapi.read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在biz.ritter.javapi的用法示例。


在下文中一共展示了biz.ritter.javapi.read方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: readFullyAndClose

        /**
         * Reads all the bytes from the given input stream.
         *
         * Calls read multiple times on the given input stream until it receives an
         * end of file marker. Returns the combined results as a byte array. Note
         * that this method may block if the underlying stream read blocks.
         *
         * @param is
         *            the input stream to be read.
         * @return the content of the stream as a byte array.
         * @throws IOException
         *             if a read error occurs.
         */
        public static byte[] readFullyAndClose(java.io.InputStream isJ)
        {
            // throws IOException {

            try {
                // Initial read
                byte[] buffer = new byte[1024];
                int count = isJ.read(buffer);
                int nextByte = isJ.read();

                // Did we get it all in one read?
                if (nextByte == -1) {
                    byte[] dest = new byte[count];
                    java.lang.SystemJ.arraycopy(buffer, 0, dest, 0, count);
                    return dest;
                }

                // Requires additional reads
                java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(count * 2);
                baos.write(buffer, 0, count);
                baos.write(nextByte);
                while (true) {
                    count = isJ.read(buffer);
                    if (count == -1) {
                        return baos.toByteArray();
                    }
                    baos.write(buffer, 0, count);
                }
            } finally {
                isJ.close();
            }
        }
开发者ID:gadfly,项目名称:nofs,代码行数:45,代码来源:org.apache.harmony.luni.util.InputStreamHelper.cs

示例2: readShortLE

 //throws IOException
 /*
     * Read a two-byte short in little-endian order.
     */
 internal int readShortLE(java.io.InputStream inJ)
 {
     if (inJ.read(b, 0, 2) == 2) {
         return (b[0] & 0XFF) | ((b[1] & 0XFF) << 8);
     } else {
         throw new java.io.EOFException();//Messages.getString("archive.3C"));
     }
 }
开发者ID:gadfly,项目名称:nofs,代码行数:12,代码来源:java.util.zip.ZipEntry.cs

示例3: readIntLE

 //throws IOException
 /*
     * Read a four-byte int in little-endian order.
     */
 internal long readIntLE(java.io.InputStream inJ)
 {
     if (inJ.read(b, 0, 4) == 4) {
         return (   ((b[0] & 0XFF))
                     | ((b[1] & 0XFF) << 8)
                     | ((b[2] & 0XFF) << 16)
                     | ((b[3] & 0XFF) << 24))
                 & 0XFFFFFFFFL; // Here for sure NO sign extension is wanted.
     } else {
         throw new java.io.EOFException();//Messages.getString("archive.3D"));
     }
 }
开发者ID:gadfly,项目名称:nofs,代码行数:16,代码来源:java.util.zip.ZipEntry.cs

示例4: myReadFully

        //throws IOException
        private void myReadFully(java.io.InputStream inJ, byte[] b)
        {
            int len = b.Length;
            int off = 0;

            while (len > 0) {
                int count = inJ.read(b, off, len);
                if (count <= 0) {
                    throw new java.io.EOFException();
                }
                off += count;
                len -= count;
            }
        }
开发者ID:gadfly,项目名称:nofs,代码行数:15,代码来源:java.util.zip.ZipEntry.cs

示例5: readFully

        /*
         * Helper to read the entire contents of the manifest from the
         * given input stream.  Usually we can do this in a single read
         * but we need to account for 'infinite' streams, by ensuring we
         * have a line feed within a reasonable number of characters.
         */
        private byte[] readFully(java.io.InputStream isJ)
        {
            // throws IOException {
            // Initial read
            byte[] buffer = new byte[4096];
            int count = isJ.read(buffer);
            int nextByte = isJ.read();

            // Did we get it all in one read?
            if (nextByte == -1) {
                byte[] dest = new byte[count];
                java.lang.SystemJ.arraycopy(buffer, 0, dest, 0, count);
                return dest;
            }

            // Does it look like a manifest?
            if (!containsLine(buffer, count)) {
                // archive.2E=Manifest is too long
                throw new java.io.IOException("Manifest is too long"); //$NON-NLS-1$
            }

            // Requires additional reads
            java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(count * 2);
            baos.write(buffer, 0, count);
            baos.write(nextByte);
            while (true) {
                count = isJ.read(buffer);
                if (count == -1) {
                    return baos.toByteArray();
                }
                baos.write(buffer, 0, count);
            }
        }
开发者ID:sailesh341,项目名称:JavApi,代码行数:39,代码来源:java.util.jar.Manifest.cs


注:本文中的biz.ritter.javapi.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。