public class WcAction extends Object implements org.apache.karaf.shell.api.action.Action
| Modifier and Type | Class and Description |
|---|---|
protected static class |
WcAction.WordCounts
Represent a basic object to store the word count data.
|
| Constructor and Description |
|---|
WcAction() |
| Modifier and Type | Method and Description |
|---|---|
Object |
execute() |
protected String |
formatWordCounts(WcAction.WordCounts wordCounts,
String reportName)
Create a human readable format of the given count information.
|
protected String |
getFilesWordCountReport(List<File> files)
Create a combined word count report of the required files.
|
protected WcAction.WordCounts |
getWordCounts(InputStream inputStream)
Perform the main logic of counting the relevant data within a given input stream.
|
protected void |
setDefaultOptions()
Set the default options for this action if none have been supplied.
|
public Object execute() throws Exception
execute in interface org.apache.karaf.shell.api.action.ActionExceptionprotected String getFilesWordCountReport(List<File> files) throws IOException
files - the list of files.IOException - in case of a count failure.protected void setDefaultOptions()
protected WcAction.WordCounts getWordCounts(InputStream inputStream) throws IOException
inputStream - the input stream.IOException - in case of word count failure.protected String formatWordCounts(WcAction.WordCounts wordCounts, String reportName)
wordCounts - the word count object containing the information.reportName - the name associated with the word counts, ie a file name.Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.