Tabnine Logo
ExtraFields.remove
Code IndexAdd Tabnine to your IDE (free)

How to use
remove
method
in
de.schlichtherle.truezip.zip.ExtraFields

Best Java code snippets using de.schlichtherle.truezip.zip.ExtraFields.remove (Showing top 4 results out of 315)

origin: de.schlichtherle.truezip/truezip-driver-zip

final @Nullable ExtraField removeExtraField(final int headerId) {
  final ExtraFields fields = this.fields;
  return null != fields ? fields.remove(headerId) : null;
}
origin: de.schlichtherle.truezip/truezip-driver-zip

/**
 * @throws IllegalArgumentException if the serialized extra fields do not
 *         conform to the ZIP File Format Specification.
 */
private void setExtraFields(final byte[] buf, final boolean zip64)
throws IllegalArgumentException {
  assert UShort.check(buf.length);
  if (0 < buf.length) {
    final ExtraFields fields = new ExtraFields();
    try {
      fields.readFrom(buf, 0, buf.length);
      if (zip64) parseZip64ExtraField(fields);
    } catch (final IndexOutOfBoundsException ex) {
      throw new IllegalArgumentException(ex);
    }
    fields.remove(ZIP64_HEADER_ID);
    this.fields = 0 < fields.size() ? fields : null;
  } else {
    this.fields = null;
  }
}
origin: de.schlichtherle.truezip/truezip-driver-zip

@Test
public void testCollection0() {
  fields.readFrom(serialized, 0, serialized.length);
  final ExtraField ef = fields.get(ExtraField.ZIP64_HEADER_ID);
  assertNotNull(ef);
  assertSame(ef, fields.remove(ExtraField.ZIP64_HEADER_ID));
  assertNull(fields.get(ExtraField.ZIP64_HEADER_ID));
  assertNull(fields.add(ef));
  final byte[] got = fields.getExtra();
  assertNotSame(serialized, got);
  assertTrue(Arrays.equals(serialized, got));
}
origin: de.schlichtherle.truezip/truezip-driver-zip

  @Test
  public void testCollection1() {
    assertEquals(0, fields.getExtra().length);
    final ExtraField ef = new DefaultExtraField(ExtraField.ZIP64_HEADER_ID);
    assertNull(fields.get(ExtraField.ZIP64_HEADER_ID));
    assertNull(fields.add(ef));
    byte[] got = fields.getExtra();
    assertEquals(4 + ef.getDataSize(), got.length);
    assertSame(ef, fields.remove(ExtraField.ZIP64_HEADER_ID));
    assertEquals(0, fields.getExtra().length);
  }
}
de.schlichtherle.truezip.zipExtraFieldsremove

Javadoc

Removes the Extra Field with the given Header ID.

Popular methods of ExtraFields

  • <init>
  • add
    Stores the given Extra Field in this collection.
  • get
    Returns the Extra Field with the given Header ID or nullif no such Extra Field exists.
  • getExtra
    Returns a protective copy of the Extra Fields. null is never returned.
  • getExtraLength
    Returns the number of bytes required to hold the Extra Fields.
  • readFrom
    Deserializes this collection of extra fields from the data block starting at the zero based offset o
  • clone
    Returns a shallow clone of this collection.
  • doSomethingWithExtraFields
  • size
    Returns the number of Extra Fields in this collection.
  • writeTo
    Serializes a list of Extra Fields of #getExtraLength bytes to the byte array data at the zero based

Popular in Java

  • Updating database using SQL prepared statement
  • getApplicationContext (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSystemService (Context)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Join (org.hibernate.mapping)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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