@Test public void testGetFileName() throws Exception { String fileName = new String("\u2591\u2592\u2593AWESOME\u2593\u2592\u2591"); byte[] utf8Bytes = fileName.getBytes("UTF8"); byte[] cp437Bytes = fileName.getBytes("Cp437"); Assert.assertFalse(Arrays.equals(utf8Bytes, cp437Bytes)); MinimalZipEntry utf8Entry = new MinimalZipEntry( COMPRESSION_METHOD, CRC32, COMPRESSED_SIZE, UNCOMPRESSED_SIZE, utf8Bytes, true , FILE_OFFSET_OF_LOCAL_ENTRY); Assert.assertArrayEquals(utf8Bytes, utf8Entry.getFileNameBytes()); String fileNameFromUtf8Bytes = utf8Entry.getFileName(); Assert.assertEquals(fileName, fileNameFromUtf8Bytes); MinimalZipEntry cp437Entry = new MinimalZipEntry( COMPRESSION_METHOD, CRC32, COMPRESSED_SIZE, UNCOMPRESSED_SIZE, cp437Bytes, false , FILE_OFFSET_OF_LOCAL_ENTRY); Assert.assertArrayEquals(cp437Bytes, cp437Entry.getFileNameBytes()); String fileNameFromCp437Bytes = cp437Entry.getFileName(); Assert.assertEquals(fileName, fileNameFromCp437Bytes); }
public String getFileName() { String charsetName = generalPurposeFlagBit11 ? "UTF8" : "Cp437"; try { return new String(fileNameBytes, charsetName); } catch (UnsupportedEncodingException e) { throw new RuntimeException("System doesn't support " + charsetName, e); } }
MinimalZipEntry { public String getFileName() { String charsetName = generalPurposeFlagBit11 ? "UTF8" : "Cp437"; try { return new String(fileNameBytes, charsetName); } catch (UnsupportedEncodingException e) { throw new RuntimeException("System doesn't support " + charsetName, e); } } }
MinimalZipEntry { public String getFileName() { String charsetName = generalPurposeFlagBit11 ? "UTF8" : "Cp437"; try { return new String(fileNameBytes, charsetName); } catch (UnsupportedEncodingException e) { throw new RuntimeException("System doesn't support " + charsetName, e); } } MinimalZipEntry(
      int compressionMethod,
      long crc32OfUncompressedData,
      long compressedSize,
      long uncompressedSize,
      byte[] fileNameBytes,
      boolean generalPurposeFlagBit11,
      long fileOffsetOfLocalEntry); }
MinimalZipEntry { public String getFileName() { String charsetName = generalPurposeFlagBit11 ? "UTF8" : "Cp437"; try { return new String(fileNameBytes, charsetName); } catch (UnsupportedEncodingException e) { throw new RuntimeException("System doesn't support " + charsetName, e); } } MinimalZipEntry(
      int compressionMethod,
      long crc32OfUncompressedData,
      long compressedSize,
      long uncompressedSize,
      byte[] fileNameBytes,
      boolean generalPurposeFlagBit11,
      long fileOffsetOfLocalEntry); void setFileOffsetOfCompressedData(long offset); int getCompressionMethod(); long getCrc32OfUncompressedData(); long getCompressedSize(); long getUncompressedSize(); byte[] getFileNameBytes(); String getFileName(); boolean getGeneralPurposeFlagBit11(); long getFileOffsetOfLocalEntry(); long getFileOffsetOfCompressedData(); boolean isDeflateCompressed(); @Override int hashCode(); @Override boolean equals(Object obj); }
MinimalZipEntry { public String getFileName() { String charsetName = generalPurposeFlagBit11 ? "UTF8" : "Cp437"; try { return new String(fileNameBytes, charsetName); } catch (UnsupportedEncodingException e) { throw new RuntimeException("System doesn't support " + charsetName, e); } } MinimalZipEntry(
      int compressionMethod,
      long crc32OfUncompressedData,
      long compressedSize,
      long uncompressedSize,
      byte[] fileNameBytes,
      boolean generalPurposeFlagBit11,
      long fileOffsetOfLocalEntry); void setFileOffsetOfCompressedData(long offset); int getCompressionMethod(); long getCrc32OfUncompressedData(); long getCompressedSize(); long getUncompressedSize(); byte[] getFileNameBytes(); String getFileName(); boolean getGeneralPurposeFlagBit11(); long getFileOffsetOfLocalEntry(); long getFileOffsetOfCompressedData(); boolean isDeflateCompressed(); @Override int hashCode(); @Override boolean equals(Object obj);  }