close() public method

public close ( ) : void
return void
Esempio n. 1
1
        public void UnZip(string zipFileLocation, string destinationRootFolder, string zipRootToRemove)
        {
            try
            {
                var zipFile = new ZipFile(zipFileLocation);
                var zipFileEntries = zipFile.entries();
                
                while (zipFileEntries.hasMoreElements())
                {
                    var zipEntry = (ZipEntry)zipFileEntries.nextElement();

                    var name = zipEntry.getName().Replace(zipRootToRemove, "").Replace("/", "\\").TrimStart('/').TrimStart('\\');
                    var p = this.fileSystem.Path.Combine(destinationRootFolder, name);

                    if (zipEntry.isDirectory())
                    {
                        if (!this.fileSystem.Directory.Exists(p))
                        {
                            this.fileSystem.Directory.CreateDirectory(p);
                        };
                    }
                    else
                    {
                        using (var bis = new BufferedInputStream(zipFile.getInputStream(zipEntry)))
                        {
                            var buffer = new byte[2048];
                            var count = buffer.GetLength(0);
                            using (var fos = new FileOutputStream(p))
                            {
                                using (var bos = new BufferedOutputStream(fos, count))
                                {
                                    int size;
                                    while ((size = bis.read(buffer, 0, count)) != -1)
                                    {
                                        bos.write(buffer, 0, size);
                                    }

                                    bos.flush();
                                    bos.close();
                                }
                            }

                            bis.close();
                        }
                    }
                }

                zipFile.close();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            catch (Exception e)
            {
                var t = e.ToString();
            }
        }
 public static byte[] getBytesFromFileJava(string filePath)
 {
     FileInputStream fis = new FileInputStream (new java.io.File (filePath));
     BufferedInputStream bis = new BufferedInputStream(fis);
     int numByte = bis.available();
     byte[] buff = new byte[numByte];
     bis.read(buff, 0, numByte);
     bis.close ();
     fis.close ();
     return buff;
 }
 public virtual void load(InputStream @in)
 {
   if (@in == null)
   {
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new NullPointerException();
   }
   else
   {
     IOException ioException;
     try
     {
       BufferedInputStream bufferedInputStream = new BufferedInputStream(@in);
       Properties properties = new Properties();
       properties.load((InputStream) bufferedInputStream);
       ((Hashtable) this.getConfiguration()).putAll((Map) properties);
       bufferedInputStream.close();
       return;
     }
     catch (IOException ex)
     {
       int num = 1;
       ioException = (IOException) ByteCodeHelper.MapException<IOException>((Exception) ex, (ByteCodeHelper.MapFlags) num);
     }
     Log.warn((object) "Unable to read configuration", (Exception) ioException);
   }
 }