com.android.ide.common.res2
Class MergedResourceWriter

java.lang.Object
  extended by com.android.ide.common.res2.MergeWriter<ResourceItem>
      extended by com.android.ide.common.res2.MergedResourceWriter
All Implemented Interfaces:
MergeConsumer<ResourceItem>

public class MergedResourceWriter
extends MergeWriter<ResourceItem>

A MergeWriter for assets, using ResourceItem.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.android.ide.common.res2.MergeConsumer
MergeConsumer.ConsumerException
 
Field Summary
static java.lang.String FILENAME_PREFIX
          Prefix in comments which mark the source locations for merge results
static java.lang.String FN_VALUES_XML
          Filename to save the merged file as
 
Constructor Summary
MergedResourceWriter(java.io.File rootFolder, com.android.ide.common.internal.PngCruncher pngRunner)
           
 
Method Summary
 void addItem(ResourceItem item)
          Adds an item.
 void end()
          Called after the merge ends.
 boolean ignoreItemInMerge(ResourceItem item)
           
 boolean isInsertSourceMarkers()
          Returns whether this manifest merger will insert source markers into the merged source
protected  void postWriteAction()
          Called after all the items have been added/removed.
 void removeItem(ResourceItem removedItem, ResourceItem replacedBy)
          Removes an item.
 void setInsertSourceMarkers(boolean insertSourceMarkers)
          Sets whether this manifest merger will insert source markers into the merged source
 void start()
          Called before the merge starts.
 
Methods inherited from class com.android.ide.common.res2.MergeWriter
getExecutor, getRootFolder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FN_VALUES_XML

public static final java.lang.String FN_VALUES_XML
Filename to save the merged file as

See Also:
Constant Field Values

FILENAME_PREFIX

public static final java.lang.String FILENAME_PREFIX
Prefix in comments which mark the source locations for merge results

See Also:
Constant Field Values
Constructor Detail

MergedResourceWriter

public MergedResourceWriter(@NonNull
                            java.io.File rootFolder,
                            @Nullable
                            com.android.ide.common.internal.PngCruncher pngRunner)
Method Detail

setInsertSourceMarkers

public void setInsertSourceMarkers(boolean insertSourceMarkers)
Sets whether this manifest merger will insert source markers into the merged source

Parameters:
insertSourceMarkers - if true, insert source markers

isInsertSourceMarkers

public boolean isInsertSourceMarkers()
Returns whether this manifest merger will insert source markers into the merged source

Returns:
whether this manifest merger will insert source markers into the merged source

start

public void start()
           throws MergeConsumer.ConsumerException
Description copied from interface: MergeConsumer
Called before the merge starts.

Specified by:
start in interface MergeConsumer<ResourceItem>
Overrides:
start in class MergeWriter<ResourceItem>
Throws:
MergeConsumer.ConsumerException

end

public void end()
         throws MergeConsumer.ConsumerException
Description copied from interface: MergeConsumer
Called after the merge ends.

Specified by:
end in interface MergeConsumer<ResourceItem>
Overrides:
end in class MergeWriter<ResourceItem>
Throws:
MergeConsumer.ConsumerException

ignoreItemInMerge

public boolean ignoreItemInMerge(ResourceItem item)

addItem

public void addItem(@NonNull
                    ResourceItem item)
             throws MergeConsumer.ConsumerException
Description copied from interface: MergeConsumer
Adds an item. The item may already be existing. Calling DataItem.isTouched() will indicate whether the item actually changed.

Parameters:
item - the new item.
Throws:
MergeConsumer.ConsumerException

removeItem

public void removeItem(@NonNull
                       ResourceItem removedItem,
                       @Nullable
                       ResourceItem replacedBy)
                throws MergeConsumer.ConsumerException
Description copied from interface: MergeConsumer
Removes an item. Optionally pass the item that will replace this one. This methods does not do the replacement. The replaced item is just there in case the removal can be optimized when it's a replacement vs. a removal.

Parameters:
removedItem - the removed item.
replacedBy - the optional item that replaces the removed item.
Throws:
MergeConsumer.ConsumerException

postWriteAction

protected void postWriteAction()
                        throws MergeConsumer.ConsumerException
Description copied from class: MergeWriter
Called after all the items have been added/removed. This is called by MergeWriter.end().

Overrides:
postWriteAction in class MergeWriter<ResourceItem>
Throws:
MergeConsumer.ConsumerException