/// <exception cref="System.IO.IOException"/> public override long Skip(long n) { if (!CheckEOF()) { long ret = @in.Skip(Math.Min(remain, n)); remain -= ret; return(ret); } return(0); }
/// <summary> /// Skips <code>n</code> bytes of input from the bytes that can be read from /// this input stream without blocking. /// </summary> /// <remarks> /// Skips <code>n</code> bytes of input from the bytes that can be read from /// this input stream without blocking. /// <p> /// Fewer bytes than requested might be skipped. The actual number of bytes /// skipped is equal to <code>n</code> or the result of a call to /// <see cref="Available()"><code>available</code></see> /// , whichever is smaller. If /// <code>n</code> is less than zero, no bytes are skipped. /// <p> /// The actual number of bytes skipped is returned. /// </remarks> /// <param name="n">the number of bytes to be skipped.</param> /// <returns>the actual number of bytes skipped.</returns> /// <exception> /// IOException /// if an I/O error occurs. /// </exception> /// <exception cref="System.IO.IOException"/> public override long Skip(long n) { if (!useWrap) { return(inStream.Skip(n)); } int available = ofinish - ostart; if (n > available) { n = available; } if (n < 0) { return(0); } ostart += n; return(n); }
/// <summary> /// 读取数据流 /// </summary> /// /// <param name="dis"></param> /// <param name="header"></param> /// <param name="fileTable"></param> /// <returns></returns> /// <exception cref="System.Exception"></exception> public static byte[] ReadFileFromPak(DataInputStream dis, LPKHeader header, LPKTable fileTable) { dis.Skip(fileTable.GetOffSet() - OutputOffset(header)); int fileLength = (int)fileTable.GetFileSize(); byte[] fileBuff = new byte[fileLength]; int readLength = dis.Read(fileBuff, 0, fileLength); if (readLength < fileLength) { return(null); } else { MakeBuffer(fileBuff, readLength); return(fileBuff); } }