Пример #1
0
        public byte[] GetEntryBytes(LhaEntry entry)
        {
            byte[] buffer = new byte[entry.GetOriginalSize()];
            LhaDecoderInputStream inputStream = GetInputStream(entry);

            inputStream.Read(buffer, 0, buffer.Length);
            return(buffer);
        }
Пример #2
0
 /**
  * Creates a new lha input stream.
  *
  * @param in
  *            the actual input stream
  * @param encoding
  *            character encoding name
  */
 public LhaInputStream(BinaryReader @in, Encoding encoding)
     : base(@in.BaseStream, encoding)
 {
     this.encoding = encoding;
     this.dis      = null;
     this.entry    = null;
     this.closed   = true;
 }
Пример #3
0
 /**
  * Closes the current input stream.
  *
  * @throws IOException
  *             if an I/O error has occured
  */
 public override void Close()
 {
     if (dis != null)
     {
         closed = true;
         dis.Close();
         dis = null;
     }
     base.Close();
 }
Пример #4
0
        /**
         * Reads the next lha entry and positions stream at the beginning of the
         * entry data.
         *
         * @param name
         *            the name of the entry
         * @return the LzhEntry just read
         * @throws LhaException
         *             if a lha format error has occurred
         * @throws IOException
         *             if an I/O error has occured
         */
        public virtual LhaEntry GetNextEntry()
        {
            if (entry != null)
            {
                dis.CloseEntry();
            }
            LhaEntryReader lhaEntryReader = new LhaEntryReader(this, encoding);

            entry = lhaEntryReader.ReadHeader();

            if (entry != null)
            {
                dis    = new LhaDecoderInputStream(this, entry);
                closed = false;
            }
            else
            {
                dis    = null;
                closed = true;
            }
            return(entry);
        }