private ByteBuffer getName(ZipEntry ze) throws IOException { return getEntryEncoding(ze).encode(ze.getName()); }
/** * Retrieve the bytes for the given String in the encoding set for * this Stream. * * @param name the string to get bytes from * @return the bytes as a byte array * @throws ZipException on error * * @since 1.3 */ protected byte[] getBytes(String name) throws ZipException { try { ByteBuffer b = ZipEncodingHelper.getZipEncoding(encoding).encode(name); byte[] result = new byte[b.limit()]; System.arraycopy(b.array(), b.arrayOffset(), result, 0, result.length); return result; } catch (IOException ex) { throw new ZipException("Failed to encode name: " + ex.getMessage()); } }
ByteBuffer commentB = getEntryEncoding(ze).encode(comm); ze.addExtraField(new UnicodeCommentExtraField(comm, commentB.array(), commentB.arrayOffset(),
String paxHeaderName, byte linkType, String fieldName) throws IOException { final ByteBuffer encodedName = encoding.encode(name); final int len = encodedName.limit() - encodedName.position(); if (len >= TarConstants.NAMELEN) {
ByteBuffer data = this.zipEncoding.encode(comment); int dataLen = data.limit() - data.position(); writeCounted(ZipShort.getBytes(dataLen));
ByteBuffer commentB = getEntryEncoding(ze).encode(comm); final int nameLen = name.limit() - name.position(); final int commentLen = commentB.limit() - commentB.position();