public RandomAccessFileOrArray ( String filename, bool forceRead ) : System | ||
filename | String | |
forceRead | bool | |
Результат | System |
public RandomAccessFileOrArray(String filename, bool forceRead)
{
if (!File.Exists(filename)) {
if (filename.StartsWith("file:/") || filename.StartsWith("http://") || filename.StartsWith("https://")) {
WebRequest wr = WebRequest.Create(new Uri(filename));
wr.Credentials = CredentialCache.DefaultCredentials;
Stream isp = wr.GetResponse().GetResponseStream();
try {
this.arrayIn = InputStreamToArray(isp);
return;
}
finally {
try {isp.Close();}catch{}
}
}
else {
Stream isp = BaseFont.GetResourceStream(filename);
if (isp == null)
throw new IOException(MessageLocalization.GetComposedMessage("1.not.found.as.file.or.resource", filename));
try {
this.arrayIn = InputStreamToArray(isp);
return;
}
finally {
try {isp.Close();}catch{}
}
}
}
else if (forceRead) {
Stream s = null;
try {
s = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
this.arrayIn = InputStreamToArray(s);
}
finally {
try{if (s != null) s.Close();}catch{}
}
return;
}
this.filename = filename;
rf = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
}
RandomAccessFileOrArray::RandomAccessFileOrArray ( |
|
RandomAccessFileOrArray::RandomAccessFileOrArray ( Stream isp ) : System | |
RandomAccessFileOrArray::RandomAccessFileOrArray ( String filename ) : System | |
RandomAccessFileOrArray::RandomAccessFileOrArray ( |
|
RandomAccessFileOrArray::RandomAccessFileOrArray ( byte arrayIn ) : System |