Tabnine Logo
ZipEntry.getCompressedSize
Code IndexAdd Tabnine to your IDE (free)

How to use
getCompressedSize
method
in
java.util.zip.ZipEntry

Best Java code snippets using java.util.zip.ZipEntry.getCompressedSize (Showing top 20 results out of 468)

origin: skylot/jadx

public static boolean isZipBomb(ZipEntry entry) {
  long compressedSize = entry.getCompressedSize();
  long uncompressedSize = entry.getSize();
  if (compressedSize < 0 || uncompressedSize < 0) {
    LOG.error("Zip bomb attack detected, invalid sizes: compressed {}, uncompressed {}, name {}",
        compressedSize, uncompressedSize, entry.getName());
    return true;
  }
  if (compressedSize * MAX_SIZE_DIFF < uncompressedSize) {
    LOG.error("Zip bomb attack detected, invalid sizes: compressed {}, uncompressed {}, name {}",
        compressedSize, uncompressedSize, entry.getName());
    return true;
  }
  return false;
}
origin: iBotPeaches/Apktool

@Override
public long getCompressedSize(String fileName)
    throws DirectoryException {
  ZipEntry entry = getZipFileEntry(fileName);
  return entry.getCompressedSize();
}
origin: robolectric/robolectric

long guessOffsetFor(ZipFile zipFile, ZipEntry zipEntry) {
 Enumeration<? extends ZipEntry> zipEntries = zipFile.entries();
 long offset = 0;
 while (zipEntries.hasMoreElements())
 {
  ZipEntry entry = zipEntries.nextElement();
  long fileSize = 0;
  long extra = entry.getExtra() == null ? 0 : entry.getExtra().length;
  offset += 30 + entry.getName().length() + extra;
  if (entry.getName().equals(zipEntry.getName())) {
   return offset;
  }
  if(!entry.isDirectory())
  {
   fileSize = entry.getCompressedSize();
   // Do stuff here with fileSize & offset
  }
  offset += fileSize;
 }
 throw new IllegalStateException("'" + zipEntry.getName() + "' not found");
}
/*
origin: graphhopper/graphhopper

} else {
  double factor = 1;
  if (ze.getCompressedSize() > 0 && ze.getSize() > 0)
    factor = (double) ze.getCompressedSize() / ze.getSize();
origin: robolectric/robolectric

FileMap createEntryFileMap(ZipEntryRO entry)
{
 // final _ZipEntryRO *zipEntry = reinterpret_cast<_ZipEntryRO*>(entry);
 // const ZipEntry& ze = zipEntry->entry;
 ZipEntry ze = entry.entry;
 // int fd = GetFileDescriptor(mHandle);
 int fd = -1;
 int actualLen = 0;
 if (ze.getMethod() == kCompressStored) {
  actualLen = toIntExact(ze.getSize());
 } else {
  actualLen = toIntExact(ze.getCompressedSize());
 }
 FileMap newMap = new FileMap();
 if (!newMap.createFromZip(mFileName, mHandle.zipFile, entry.entry, actualLen, true)) {
  // delete newMap;
  return null;
 }
 return newMap;
}
origin: robolectric/robolectric

boolean getEntryInfo(org.robolectric.res.android.ZipFileRO.ZipEntryRO entry, Ref<Short> pMethod,
  final Ref<Long> pUncompLen, Ref<Long> pCompLen, Ref<Long> pOffset,
  final Ref<Long> pModWhen, Ref<Long> pCrc32)
{
 final ZipEntryRO zipEntry = /*reinterpret_cast<ZipEntryRO*>*/(entry);
 final ZipEntry ze = zipEntry.entry;
 if (pMethod != null) {
  pMethod.set((short) ze.getMethod());
 }
 if (pUncompLen != null) {
   pUncompLen.set(ze.getSize()); // uncompressed_length
 }
 if (pCompLen != null) {
   pCompLen.set(ze.getCompressedSize());
 }
 if (pOffset != null) {
  throw new UnsupportedOperationException("Figure out offset");
  //        pOffset = ze.offset;
 }
 if (pModWhen != null) {
   // todo pModWhen.set(ze.getLastModifiedTime().toMillis());
 }
 if (pCrc32 != null) {
  pCrc32.set(ze.getCrc());
 }
 return true;
}
origin: jphp-group/jphp

private static ArrayMemory zipEntryToArray(ZipEntry zipEntry) {
  final ArrayMemory result = new ArrayMemory();
  result.refOfIndex("name").assign(zipEntry.getName());
  result.refOfIndex("crc").assign(zipEntry.getCrc());
  result.refOfIndex("size").assign(zipEntry.getSize());
  result.refOfIndex("compressedSize").assign(zipEntry.getCompressedSize());
  result.refOfIndex("time").assign(zipEntry.getTime());
  result.refOfIndex("method").assign(zipEntry.getMethod());
  result.refOfIndex("comment").assign(zipEntry.getComment());
  result.refOfIndex("directory").assign(zipEntry.isDirectory());
  return result;
}
origin: robovm/robovm

if (ze.getCompressedSize() == -1) {
  ze.setCompressedSize(ze.getSize());
} else if (ze.getSize() == -1) {
  ze.setSize(ze.getCompressedSize());
origin: bonigarcia/webdrivermanager

long compressedSize = zipEntry.getCompressedSize();
log.trace("Unzipping {} (size: {} KB, compressed size: {} KB)",
    name, size, compressedSize);
origin: org.vx68k.quercus/quercus

/**
 * Returns the size of the compressed data.
 *
 * @return -1, or compressed size
 */
public long zip_entry_compressedsize()
{
 if (_entry == null)
  return -1;
 return _entry.getCompressedSize();
}
origin: PrivacyApps/document-viewer

public long getCompressedSize() {
  return entry.getCompressedSize();
}
origin: stackoverflow.com

 ByteArrayInputStream bis = new ByteArrayInputStream(byteArray);
ZipInputStream zis = new ZipInputStream(bis);
ZipEntry entry = zis.getNextEntry();
InputSource inputSource = new InputSource(new BoundedInputStream(zis, entry.getCompressedSize()));
origin: stackoverflow.com

 Enumeration<? extends ZipEntry> zipEntries = zipFile.entries();
long offset = 0;
while (zipEntries.hasMoreElements())
{
  ZipEntry entry = (ZipEntry)zipEntries.nextElement();
  long fileSize = 0;
  long extra = entry.getExtra() == null ? 0 : entry.getExtra().length;
  offset += 30 + entry.getName().length() + extra;
  if(!entry.isDirectory())
  {
    fileSize = entry.getCompressedSize();

    // Do stuff here with fileSize & offset
  }    
  offset += fileSize;
}
origin: com.github.bloodshura/shurax

@Nullable
public Bytes getCompressedSize() {
  long size = getHandle().getCompressedSize();
  return size != -1 ? new Bytes(size) : null;
}
origin: com.github.bloodshura/ignitium-core

@Nullable
public Bytes getCompressedSize() {
  long size = getHandle().getCompressedSize();
  return size != -1 ? new Bytes(size) : null;
}
origin: GeeQuery/ef-orm

  public XEntry(ZipEntry entry, long offset) {
    this.entry = entry;
    this.offset = offset;
    // store size, compressed size, and crc-32 in data descriptor
    // immediately following the compressed entry data
    // store size, compressed size, and crc-32 in LOC header
    this.flag = (entry.getMethod() == DEFLATED && (entry.getSize() == -1 || entry.getCompressedSize() == -1 || entry.getCrc() == -1))? 8: 0;
  }
}
origin: davidmoten/rxjava2-extras

public ZippedEntry(ZipEntry e, InputStream is) {
  this.name = e.getName();
  this.time = e.getTime();
  // this.mtime = e.getLastModifiedTime();
  // this.atime = e.getLastAccessTime();
  // this.ctime = e.getCreationTime();
  this.crc = e.getCrc();
  this.size = e.getSize();
  this.csize = e.getCompressedSize();
  this.method = e.getMethod();
  this.extra = e.getExtra();
  this.comment = e.getComment();
  this.is = is;
}
origin: davidmoten/rxjava-extras

public ZippedEntry(ZipEntry e, InputStream is) {
  this.name = e.getName();
  this.time = e.getTime();
  // this.mtime = e.getLastModifiedTime();
  // this.atime = e.getLastAccessTime();
  // this.ctime = e.getCreationTime();
  this.crc = e.getCrc();
  this.size = e.getSize();
  this.csize = e.getCompressedSize();
  this.method = e.getMethod();
  this.extra = e.getExtra();
  this.comment = e.getComment();
  this.is = is;
}
origin: GeeQuery/ef-orm

private void writeEXT(ZipEntry e) throws IOException {
  writeInt(EXTSIG); // EXT header signature
  writeInt(e.getCrc()); // crc-32
  writeInt(e.getCompressedSize()); // compressed size
  writeInt(e.getSize()); // uncompressed size
}
origin: ujmp/universal-java-matrix-package

public ZipEntryMatrix(ZipFile zipFile, ZipEntry zipEntry) {
  this.zipFile = zipFile;
  this.zipEntry = zipEntry;
  setLabel(zipEntry.getName());
  setMetaData("CompressedSize", zipEntry.getCompressedSize());
  setMetaData("CRC", zipEntry.getCrc());
  setMetaData("Method", zipEntry.getMethod());
  setMetaData("Size", zipEntry.getSize());
  setMetaData("Time", zipEntry.getTime());
  setMetaData("IsDirectory", zipEntry.isDirectory());
  setMetaData("Comment", zipEntry.getComment());
}
java.util.zipZipEntrygetCompressedSize

Javadoc

Gets the compressed size of this ZipEntry.

Popular methods of ZipEntry

  • getName
    Gets the name of this ZipEntry.
  • <init>
  • isDirectory
    Determine whether or not this ZipEntry is a directory.
  • getSize
    Gets the uncompressed size of this ZipEntry.
  • getTime
    Gets the last modification time of this ZipEntry.
  • setSize
    Sets the uncompressed size of this ZipEntry.
  • setTime
    Sets the modification time of this ZipEntry.
  • setMethod
    Sets the compression method for this entry to either DEFLATED or STORED. The default is DEFLATED, wh
  • setCrc
    Sets the checksum for this ZipEntry.
  • getMethod
    Gets the compression method for this ZipEntry.
  • getComment
    Returns the comment for this ZipEntry, or null if there is no comment. If we're reading a zip file u
  • setCompressedSize
    Sets the compressed size for this ZipEntry.
  • getComment,
  • setCompressedSize,
  • setComment,
  • getCrc,
  • setExtra,
  • getExtra,
  • toString,
  • hashCode,
  • clone

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
  • setContentView (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now