/*
(non-Javadoc)

@see com.thedeanda.lorem.Lorem#getZipCode()
765888
@Override
	public String getZipCode() {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < 5; i++) {
			sb.append(random.nextInt(10));
		}
		return sb.toString();
	}
1242403
public static boolean isZipCode(String s) {
        if (isEmpty(s)) return defaultEmptyOK;

        String normalizedZip = stripCharsInBag(s, ZipCodeDelimiters);

        return (isInteger(normalizedZip) && ((normalizedZip.length() == digitsInZipCode1) || (normalizedZip.length() == digitsInZipCode2)));
    }
97262
String getZipFilePath() {
        return packageRootPrefix.isEmpty() ? zipFilePath
                : zipFilePath + "!/" + packageRootPrefix.substring(0, packageRootPrefix.length() - 1);
    }
444783
public Optional<ZipErrorCodes> zip()
	{
		try (FileOutputStream fos = new FileOutputStream(this.zipFile);
			ZipOutputStream zos = new ZipOutputStream(fos);)
		{

			if (!this.directoryToZip.exists())
			{
				return Optional.of(ZipErrorCodes.DIRECTORY_TO_ZIP_DOES_NOT_EXIST);
			}
			if (!this.zipFile.exists())
			{
				return Optional.of(ZipErrorCodes.ZIP_FILE_DOES_NOT_EXIST);
			}
			if (0 < this.zipLevel)
			{
				zos.setLevel(this.zipLevel);
			}
			else
			{
				zos.setLevel(9);
			}
			if (null != this.zipFileComment)
			{
				zos.setComment(this.zipFileComment);
			}
			if (0 < this.compressionMethod)
			{
				zos.setMethod(this.compressionMethod);
			}
			this.zipFiles(this.directoryToZip, zos);
			zos.flush();
			zos.finish();
			fos.flush();
		}
		catch (IOException e)
		{
			log.log(Level.SEVERE, e.getLocalizedMessage(), e);
			return Optional.of(ZipErrorCodes.IO_ERROR);
		}
		return Optional.empty();
	}
390769
public String getName() {
        // Both getPath() and getName() are very light weight method calls
        return zipIterator == null ?
                fileIterator.getFile().getPath() :
                zipIterator.getEntry().getName();
    }
788571
public function getHashCode()
    {
        $hashElements = '';
        foreach ($this->_richTextElements as $element) {
            $hashElements .= $element->getHashCode();
        }

        return md5(
              $hashElements
            . __CLASS__
        );
    }
475190
INode getINode(String src) {
    src = normalizePath(src);
    byte[][] components = INodeDirectory.getPathComponents(src);
    readLock();
    try {
      INode inode = rootDir.getNode(components);
      return inode;
    } finally {
      readUnlock();
    }
  }
469045
public static ZoneId getZoneId(String zoneId) {
        return JMMap
                .getOrPutGetNew(zoneIdCache, zoneId, () -> ZoneId.of(zoneId));
    }
893936
public function getHashCode() {
        return md5(
              $this->_author
            . $this->_text->getHashCode()
            . $this->_width
            . $this->_height
            . $this->_marginLeft
            . $this->_marginTop
            . ($this->_visible ? 1 : 0)
            . $this->_fillColor->getHashCode()
            . $this->_alignment
            . __CLASS__
        );
    }
961840
public static void mapZipFile(final byte[] zipFile, final Map<String, byte[]> output, final String keyPrefix,
            final String keyUnPrefix) {
        try {
            final String fixedKeyPrefix = keyPrefix == null ? "" : keyPrefix;
            final String fixedKeyUnPrefix = keyUnPrefix == null ? "" : keyUnPrefix;
            final ZipInputStream zf = new ZipInputStream(new ByteArrayInputStream(zipFile));

            ZipEntry ze = null;
            while ((ze = zf.getNextEntry()) != null) {
                final String name = ze.getName();
                final long size = ze.getSize();

                // see if we are working with a file or a directory
                if (size != 0) {
                    byte[] fileContents = new byte[0];
                    final byte[] fileBuffer = new byte[BUFFER_SIZE];

                    int bytesRead = 0;
                    while ((bytesRead = zf.read(fileBuffer, 0, BUFFER_SIZE)) != -1) fileContents = ArrayUtils.addAll(fileContents,
                            bytesRead == BUFFER_SIZE ? fileBuffer : ArrayUtils.subarray(fileBuffer, 0, bytesRead));

                    output.put(fixedKeyPrefix + name.replace(fixedKeyUnPrefix, ""), fileContents);
                }
            }

        } catch (final IOException ex) {
           LOG.error("Unable to read file contents", ex);
        }
    }
705388
private function getZipper()
    {
        $app = $this->app;
        return function($last, MiddlewareInterface $middleware) use ($app) {
            return $app->make(DelegateInterface::class, [$middleware, $last]);
        };
    }
353130
public ZipFileBuilder asZip() {
        final ZipFileBuilder zfb = new ZipFileBuilder(folder, filename);
        if(this.content != null) {
            zfb.addResource(getContenFileName(), this.content);
        }
        return zfb;
    }
775886
public void checkZipCode(String zipcode) throws CmsIllegalArgumentException {

        if (!CmsStringUtil.validateRegex(zipcode, ZIPCODE_REGEX, true)) {
            throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_ZIPCODE_VALIDATION_1, zipcode));
        }
    }
76602
protected String getStringFromNode(Object inNode)
  {
    if (tc.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(cclass, "getStringFromNode", inNode);
    
    String strValue = null;
    if (inNode instanceof Node)
    {
      Node theNode = (Node)inNode;
      // Check the type of the node
      int nodeType = theNode.getNodeType();
      if(nodeType == Node.ATTRIBUTE_NODE)
      {
        strValue = theNode.getNodeValue();
      }
//TODO: More special casing needed here dependent on node type? text etc?        
      else
      {
        // Note this gets the text associated with the first child element only.
        Node firstChild = theNode.getFirstChild();
        if(firstChild != null)
          strValue = firstChild.getNodeValue();
      }
    }  // eof is inNode instanceof Node
    
    if (tc.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(cclass, "getStringFromNode", strValue);    
    return strValue;
  }
288761
static byte[][] getINodeByteArray(INode inode) throws IOException {
    // calculate the depth of this inode from root
    int depth = getPathDepth(inode);
    
    byte[][] names = new byte[depth][];

    // fill up the inodes in the path from this inode to root
    for (int i = 0; i < depth; i++) {
      names[depth-i-1] = inode.getLocalNameBytes();
      inode = inode.parent;
    }
    return names;
  }
459804
synchronized Entry getZipIndexEntry(RelativePath path) {
        try {
            checkIndex();
            DirectoryEntry de = directories.get(path.dirname());
            String lookFor = path.basename();
            return (de == null) ? null : de.getEntry(lookFor);
        }
        catch (IOException e) {
            return null;
        }
    }
35493
public Iterable<DUser> queryByZipCode(java.lang.String zipCode) {
    return queryByField(null, DUserMapper.Field.ZIPCODE.getFieldName(), zipCode);
  }