Class FunctionBINFILE
- java.lang.Object
-
- com.igormaznitsa.jcp.expression.functions.AbstractFunction
-
- com.igormaznitsa.jcp.expression.functions.FunctionBINFILE
-
- All Implemented Interfaces:
ExpressionItem
public class FunctionBINFILE extends AbstractFunction
The Function loads bin file and encodes it into string.- Since:
- 6.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
FunctionBINFILE.Type
-
Field Summary
Fields Modifier and Type Field Description private static ValueType[][]
ARG_TYPES
-
Fields inherited from class com.igormaznitsa.jcp.expression.functions.AbstractFunction
ALL_FUNCTIONS, EXECUTION_PREFIX, FUNCTION_NAME_MAP, UID_COUNTER
-
-
Constructor Summary
Constructors Constructor Description FunctionBINFILE()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
convertTo(java.io.File file, FunctionBINFILE.Type type, boolean deflate, int lineLength, java.lang.String endOfLine)
private static byte[]
deflate(byte[] data)
Value
executeStrStr(PreprocessorContext context, Value strfilePath, Value encodeType)
ValueType[][]
getAllowedArgumentTypes()
Get arrays of supported argument typesint
getArity()
Get the function arityjava.lang.String
getName()
Get the function namejava.lang.String
getReference()
Get the function reference to be output for a help requestValueType
getResultType()
Get the result typeprivate static boolean
hasDeflateFlag(java.lang.String name, FunctionBINFILE.Type type)
private static boolean
hasSplitFlag(java.lang.String name, FunctionBINFILE.Type type)
-
Methods inherited from class com.igormaznitsa.jcp.expression.functions.AbstractFunction
findForClass, findForName, getExpressionItemPriority, getExpressionItemType, toString
-
-
-
-
Field Detail
-
ARG_TYPES
private static final ValueType[][] ARG_TYPES
-
-
Method Detail
-
hasSplitFlag
private static boolean hasSplitFlag(java.lang.String name, FunctionBINFILE.Type type)
-
hasDeflateFlag
private static boolean hasDeflateFlag(java.lang.String name, FunctionBINFILE.Type type)
-
getName
public java.lang.String getName()
Description copied from class:AbstractFunction
Get the function name- Specified by:
getName
in classAbstractFunction
- Returns:
- the function name in lower case, must not be null
-
getReference
public java.lang.String getReference()
Description copied from class:AbstractFunction
Get the function reference to be output for a help request- Specified by:
getReference
in classAbstractFunction
- Returns:
- the function information as a String, must not be null
-
getArity
public int getArity()
Description copied from class:AbstractFunction
Get the function arity- Specified by:
getArity
in classAbstractFunction
- Returns:
- the function arity (zero or greater)
-
getAllowedArgumentTypes
@MustNotContainNull public ValueType[][] getAllowedArgumentTypes()
Description copied from class:AbstractFunction
Get arrays of supported argument types- Specified by:
getAllowedArgumentTypes
in classAbstractFunction
- Returns:
- the array of argument type combinations allowed by the function handler, must not be null
-
getResultType
public ValueType getResultType()
Description copied from class:AbstractFunction
Get the result type- Specified by:
getResultType
in classAbstractFunction
- Returns:
- the result type of the function, must not be null
-
executeStrStr
public Value executeStrStr(PreprocessorContext context, Value strfilePath, Value encodeType)
-
convertTo
private static java.lang.String convertTo(java.io.File file, FunctionBINFILE.Type type, boolean deflate, int lineLength, java.lang.String endOfLine) throws java.io.IOException
- Throws:
java.io.IOException
-
deflate
private static byte[] deflate(byte[] data) throws java.io.IOException
- Throws:
java.io.IOException
-
-