Class ExtraField.AlignmentSegment
- java.lang.Object
-
- com.android.tools.build.apkzlib.zip.ExtraField.AlignmentSegment
-
- All Implemented Interfaces:
ExtraField.Segment
- Enclosing class:
- ExtraField
public static class ExtraField.AlignmentSegment extends java.lang.Object implements ExtraField.Segment
Segment with information on an alignment: this segment contains information on how an entry should be aligned and contains zero-filled data to force alignment.An alignment segment contains the header ID, the size of the data, the alignment value and zero bytes to pad
-
-
Field Summary
Fields Modifier and Type Field Description static intMINIMUM_SIZEMinimum size for an alignment segment.
-
Constructor Summary
Constructors Constructor Description AlignmentSegment(int headerId, byte[] data)Creates a new alignment segment from extra data.AlignmentSegment(int alignment, int totalSize)Creates a new alignment segment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetHeaderId()Obtains the segment's header ID.intsize()Obtains the size of the segment including the header ID.voidwrite(java.nio.ByteBuffer out)Writes the segment to a buffer.
-
-
-
Field Detail
-
MINIMUM_SIZE
public static final int MINIMUM_SIZE
Minimum size for an alignment segment.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AlignmentSegment
public AlignmentSegment(int alignment, int totalSize)Creates a new alignment segment.- Parameters:
alignment- the alignment valuetotalSize- how many bytes should this segment take?
-
AlignmentSegment
public AlignmentSegment(int headerId, byte[] data) throws java.io.IOExceptionCreates a new alignment segment from extra data.- Parameters:
headerId- the header IDdata- the segment data- Throws:
java.io.IOException- failed to create the segment from the data
-
-
Method Detail
-
write
public void write(java.nio.ByteBuffer out) throws java.io.IOExceptionDescription copied from interface:ExtraField.SegmentWrites the segment to a buffer.- Specified by:
writein interfaceExtraField.Segment- Parameters:
out- the buffer where to write the segment to; exactlyExtraField.Segment.size()bytes will be written- Throws:
java.io.IOException- failed to write segment data
-
size
public int size()
Description copied from interface:ExtraField.SegmentObtains the size of the segment including the header ID.- Specified by:
sizein interfaceExtraField.Segment- Returns:
- the number of bytes needed to write the segment
-
getHeaderId
public int getHeaderId()
Description copied from interface:ExtraField.SegmentObtains the segment's header ID.- Specified by:
getHeaderIdin interfaceExtraField.Segment- Returns:
- the segment's header ID
-
-