MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / run

Method run

src/main/java/net/minecraft/util/HttpUtil.java:142–289  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140 ListenableFuture<?> listenablefuture = field_180193_a.submit(new Runnable()
141 {
142 public void run()
143 {
144 HttpURLConnection httpurlconnection = null;
145 InputStream inputstream = null;
146 OutputStream outputstream = null;
147
148 if (p_180192_4_ != null)
149 {
150 p_180192_4_.resetProgressAndMessage("Downloading Resource Pack");
151 p_180192_4_.displayLoadingString("Making Request...");
152 }
153
154 try
155 {
156 try
157 {
158 byte[] abyte = new byte[4096];
159 URL url = new URL(packUrl);
160 httpurlconnection = (HttpURLConnection)url.openConnection(p_180192_5_);
161 float f = 0.0F;
162 float f1 = (float)p_180192_2_.entrySet().size();
163
164 for (Entry<String, String> entry : p_180192_2_.entrySet())
165 {
166 httpurlconnection.setRequestProperty(entry.getKey(), entry.getValue());
167
168 if (p_180192_4_ != null)
169 {
170 p_180192_4_.setLoadingProgress((int)(++f / f1 * 100.0F));
171 }
172 }
173
174 inputstream = httpurlconnection.getInputStream();
175 f1 = (float)httpurlconnection.getContentLength();
176 int i = httpurlconnection.getContentLength();
177
178 if (p_180192_4_ != null)
179 {
180 p_180192_4_.displayLoadingString(String.format("Downloading file (%.2f MB)...", f1 / 1000.0F / 1000.0F));
181 }
182
183 if (saveFile.exists())
184 {
185 long j = saveFile.length();
186
187 if (j == (long)i)
188 {
189 if (p_180192_4_ != null)
190 {
191 p_180192_4_.setDoneWorking();
192 }
193
194 return;
195 }
196
197 HttpUtil.logger.warn("Deleting " + saveFile + " as it does not match what we currently have (" + i + " vs our " + j + ").");
198 FileUtils.deleteQuietly(saveFile);
199 }

Callers 1

func_181617_aMethod · 0.45

Calls 15

openConnectionMethod · 0.80
entrySetMethod · 0.80
lengthMethod · 0.80
displayLoadingStringMethod · 0.65
getValueMethod · 0.65
setLoadingProgressMethod · 0.65
getInputStreamMethod · 0.65
formatMethod · 0.65
setDoneWorkingMethod · 0.65
sizeMethod · 0.45
getKeyMethod · 0.45

Tested by

no test coverage detected