123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- /*** Eclipse Class Decompiler plugin, copyright (c) 2016 Chen Chao (cnfree2000@hotmail.com) ***/
- package DBstep;
- import java.io.File;
- import java.io.FileOutputStream;
- import javax.servlet.http.HttpServletRequest;
- public class iFileUpLoad2000 {
- public String FFilePath;
- public String FFileName;
- public byte[] FBuffer;
- public int FBufLen;
- public int FBinLen;
- public byte[] FSingBuf;
- public int FSingLen;
- public String FCopyright;
- public iFileUpLoad2000(HttpServletRequest request) {
- int totalRead = 0;
- boolean readBytes = false;
- boolean mSingCur = false;
- try {
- this.FBufLen = request.getContentLength();
- int arg6;
- for (this.FBuffer = new byte[this.FBufLen]; totalRead < this.FBufLen; totalRead += arg6) {
- request.getInputStream();
- arg6 = request.getInputStream().read(this.FBuffer, totalRead,
- this.FBufLen - totalRead);
- }
- } catch (Exception arg5) {
- System.out.println(arg5.toString());
- }
- for (this.FSingLen = 0; this.FBuffer[this.FSingLen] != 13; ++this.FSingLen) {
- ;
- }
- this.FSingBuf = new byte[this.FSingLen];
- for (int arg7 = 0; arg7 < this.FSingLen; ++arg7) {
- this.FSingBuf[arg7] = this.FBuffer[arg7];
- }
- this.FFilePath = "";
- this.FFileName = "";
- this.FCopyright = "[数据驿站,版权所有]";
- }
- public int FindSing(int Start) {
- boolean result = true;
- int s = Start;
- int arg5;
- while (true) {
- if (s >= this.FBufLen - this.FSingLen) {
- arg5 = -1;
- break;
- }
- boolean DjfOk = true;
- for (int i = 0; i < this.FSingLen; ++i) {
- if (this.FSingBuf[i] != this.FBuffer[s + i]) {
- DjfOk = false;
- break;
- }
- }
- if (DjfOk) {
- arg5 = s;
- break;
- }
- ++s;
- }
- return arg5;
- }
- public int FindItem(String TagName) {
- boolean result = true;
- int s = 0;
- int arg5;
- while (true) {
- s = this.FindSing(s);
- if (s == -1) {
- arg5 = -1;
- break;
- }
- s = s + this.FSingLen + 40;
- int e = s;
- if (s + 1 >= this.FBufLen) {
- arg5 = -1;
- break;
- }
- while (this.FBuffer[e + 1] != 34) {
- ++e;
- }
- String strName = new String(this.FBuffer, s, e - s + 1);
- if (TagName.equalsIgnoreCase(strName)) {
- arg5 = e + 1;
- break;
- }
- }
- return arg5;
- }
- public String ItemValue(String TagName) {
- String strTmp = "";
- String result = "";
- int s = this.FindItem(TagName);
- if (s == -1) {
- return result;
- } else {
- int e;
- if (this.FBuffer[s + 1] == 59) {
- s += 13;
- for (e = s; this.FBuffer[e + 1] != 34; ++e) {
- ;
- }
- } else {
- s += 5;
- e = this.FindSing(s) - 3;
- }
- if (e - s < 0) {
- return result;
- } else {
- strTmp = new String(this.FBuffer, s, e - s + 1);
- return strTmp;
- }
- }
- }
- public String ExtName(String TagName) {
- String mFileName = "";
- String mExtName = "";
- mExtName = "";
- mFileName = this.ItemValue(TagName);
- if (mFileName != "") {
- mExtName = mFileName.substring(mFileName.lastIndexOf("."));
- }
- return mExtName;
- }
- public byte[] FileBody(String TagName) {
- byte[] mBody = null;
- int s = this.FindItem(TagName);
- if (s == -1) {
- return mBody;
- } else {
- s += 13;
- int i;
- for (i = s; this.FBuffer[i] != 34; ++i) {
- ;
- }
- int e = i - 1;
- if (e - s < 0) {
- return mBody;
- } else {
- for (i = e; this.FBuffer[i - 4] != 13
- || this.FBuffer[i - 3] != 10
- || this.FBuffer[i - 2] != 13
- || this.FBuffer[i - 1] != 10; ++i) {
- ;
- }
- e = this.FindSing(i) - 3;
- if (e - i >= 0) {
- mBody = new byte[e - i + 1];
- int j = 0;
- for (i = i; i <= e; ++i) {
- mBody[j] = this.FBuffer[i];
- ++j;
- }
- }
- return mBody;
- }
- }
- }
- public String FileName(String TagName) {
- String result = "";
- int s = this.FindItem(TagName);
- if (s == -1) {
- return result;
- } else {
- s += 13;
- int i;
- for (i = s; this.FBuffer[i] != 34; ++i) {
- ;
- }
- int e = i - 1;
- if (e - s < 0) {
- return result;
- } else {
- for (i = e; i >= s; --i) {
- if ((char) this.FBuffer[i - 1] == 92) {
- s = i;
- break;
- }
- }
- result = new String(this.FBuffer, s, e - s + 1);
- return result;
- }
- }
- }
- public int FileSize(String TagName) {
- byte result = 0;
- int s = this.FindItem(TagName);
- if (s == -1) {
- return result;
- } else {
- s += 13;
- int i;
- for (i = s; this.FBuffer[i] != 34; ++i) {
- ;
- }
- int e = i - 1;
- if (e - s < 0) {
- return result;
- } else {
- for (i = e; this.FBuffer[i - 4] != 13
- || this.FBuffer[i - 3] != 10
- || this.FBuffer[i - 2] != 13
- || this.FBuffer[i - 1] != 10; ++i) {
- ;
- }
- e = this.FindSing(i) - 3;
- int arg5 = e - i + 1;
- return arg5;
- }
- }
- }
- public String CopyRight() {
- return this.FCopyright;
- }
- public String getFilePath() {
- return this.FFilePath;
- }
- public String Request(String TagName) {
- return this.ItemValue(TagName);
- }
- public boolean SaveAll(String FileName) {
- boolean result = false;
- try {
- FileOutputStream ex = new FileOutputStream(String.valueOf(String
- .valueOf((new StringBuffer(String.valueOf(String
- .valueOf(this.FFilePath)))).append('\\').append(
- FileName))));
- for (int i = 0; i < this.FBufLen; ++i) {
- ex.write(this.FBuffer[i]);
- }
- ex.close();
- result = true;
- } catch (Exception arg4) {
- System.out.println(arg4.toString());
- result = false;
- }
- return result;
- }
- public boolean SaveFile(String TagName, String FileName) {
- String mFileName = "";
- boolean result = false;
- int s = this.FindItem(TagName);
- if (s == -1) {
- result = false;
- return result;
- } else {
- s += 13;
- int i;
- for (i = s; this.FBuffer[i] != 34; ++i) {
- ;
- }
- int e = i - 1;
- if (e - s < 0) {
- result = false;
- return result;
- } else {
- for (i = e; i >= s; --i) {
- if ((char) this.FBuffer[i - 1] == 92) {
- s = i;
- break;
- }
- }
- this.FFileName = new String(this.FBuffer, s, e - s + 1);
- if (FileName.trim() != "") {
- this.FFileName = FileName;
- }
- for (i = e; this.FBuffer[i - 4] != 13
- || this.FBuffer[i - 3] != 10
- || this.FBuffer[i - 2] != 13
- || this.FBuffer[i - 1] != 10; ++i) {
- ;
- }
- s = i;
- e = this.FindSing(i) - 3;
- try {
- FileOutputStream ex = new FileOutputStream(
- String.valueOf(String.valueOf((new StringBuffer(
- String.valueOf(String
- .valueOf(this.FFilePath)))).append(
- '\\').append(this.FFileName))));
- if (ex == null) {
- result = false;
- } else if (e - s >= 0) {
- for (i = s; i <= e; ++i) {
- ex.write(this.FBuffer[i]);
- }
- result = true;
- }
- ex.close();
- } catch (Exception arg8) {
- System.out.println(arg8.toString());
- result = false;
- }
- return result;
- }
- }
- }
- public boolean setFilePath(String Value) {
- this.FFilePath = Value;
- File mFile = new File(this.FFilePath);
- mFile.mkdirs();
- return mFile.isDirectory();
- }
- }
|