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
 
Constructor Summary
MergedResourceWriter(java.io.File rootFolder, com.android.ide.common.internal.PngCruncher pngRunner, boolean crunchPng, boolean process9Patch, java.io.File publicFile, java.io.File blameLogFolder, ResourcePreprocessor preprocessor)
           
 
Method Summary
 void addItem(ResourceItem item)
          Adds an item.
 void end()
          Called after the merge ends.
 boolean ignoreItemInMerge(ResourceItem item)
           
protected  void postWriteAction()
          Called after all the items have been added/removed.
 void removeItem(ResourceItem removedItem, ResourceItem replacedBy)
          Removes an item.
 void start(javax.xml.parsers.DocumentBuilderFactory factory)
          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
 

Constructor Detail

MergedResourceWriter

public MergedResourceWriter(@NonNull
                            java.io.File rootFolder,
                            @NonNull
                            com.android.ide.common.internal.PngCruncher pngRunner,
                            boolean crunchPng,
                            boolean process9Patch,
                            @Nullable
                            java.io.File publicFile,
                            @Nullable
                            java.io.File blameLogFolder,
                            @NonNull
                            ResourcePreprocessor preprocessor)
Method Detail

start

public void start(@NonNull
                  javax.xml.parsers.DocumentBuilderFactory factory)
           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