48 |
import java.io.IOException; |
import java.io.IOException; |
49 |
import java.io.InputStream; |
import java.io.InputStream; |
50 |
import java.io.RandomAccessFile; |
import java.io.RandomAccessFile; |
51 |
|
import java.io.UnsupportedEncodingException; |
52 |
import java.util.Enumeration; |
import java.util.Enumeration; |
53 |
import java.util.HashMap; |
import java.util.HashMap; |
54 |
import java.util.Iterator; |
import java.util.Iterator; |
285 |
buffer = new byte[needBuffer]; |
buffer = new byte[needBuffer]; |
286 |
|
|
287 |
raf.readFully(buffer, 0, nameLen); |
raf.readFully(buffer, 0, nameLen); |
288 |
String name = new String(buffer, 0, 0, nameLen); |
String name; |
289 |
|
try |
290 |
|
{ |
291 |
|
name = new String(buffer, 0, nameLen, "UTF-8"); |
292 |
|
} |
293 |
|
catch (UnsupportedEncodingException uee) |
294 |
|
{ |
295 |
|
throw new AssertionError(uee); |
296 |
|
} |
297 |
|
|
298 |
ZipEntry entry = new ZipEntry(name); |
ZipEntry entry = new ZipEntry(name); |
299 |
entry.setMethod(method); |
entry.setMethod(method); |
310 |
if (commentLen > 0) |
if (commentLen > 0) |
311 |
{ |
{ |
312 |
raf.readFully(buffer, 0, commentLen); |
raf.readFully(buffer, 0, commentLen); |
313 |
entry.setComment(new String(buffer, 0, commentLen)); |
try |
314 |
|
{ |
315 |
|
entry.setComment(new String(buffer, 0, commentLen, "UTF-8")); |
316 |
|
} |
317 |
|
catch (UnsupportedEncodingException uee) |
318 |
|
{ |
319 |
|
throw new AssertionError(uee); |
320 |
|
} |
321 |
} |
} |
322 |
entry.offset = offset; |
entry.offset = offset; |
323 |
entries.put(name, entry); |
entries.put(name, entry); |
333 |
*/ |
*/ |
334 |
public void close() throws IOException |
public void close() throws IOException |
335 |
{ |
{ |
336 |
|
RandomAccessFile raf = this.raf; |
337 |
|
if (raf == null) |
338 |
|
return; |
339 |
|
|
340 |
synchronized (raf) |
synchronized (raf) |
341 |
{ |
{ |
342 |
closed = true; |
closed = true; |