.apply(InfixOperator.GREATER, Models.toLiteral(f, 0L))
.toExpression();
if (isFastMode() == false) {
statements.add(f.newIfStatement(
isNotHead,
f.newBlock(new TypeBuilder(f, context.resolve(IllegalArgumentException.class))
.newObject(Models.toLiteral(f, MessageFormat.format(
"{0} does not support fragmentation.",
context.getQualifiedTypeName().toNameString())))
.toThrowStatement())));
}
SimpleName fragmentInput = f.newSimpleName("fragmentInput");
statements.add(f.newLocalVariableDeclaration(
context.resolve(InputStream.class),
fragmentInput,
null));
if (isFastMode()) {
statements.add(new ExpressionBuilder(f, fragmentInput)
.assignFrom(new TypeBuilder(f, context.resolve(DelimiterRangeInputStream.class))
.newObject(
blessInputStream(stream),
Models.toLiteral(f, '\n'),
fragmentSize,
isNotHead)
.toExpression())
.toStatement());
} else {
statements.add(new ExpressionBuilder(f, fragmentInput)
.assignFrom(blessInputStream(stream))
.toStatement());
}
if (conf.isEnableHeader()) {
statements.add(f.newIfStatement(
new ExpressionBuilder(f, offset)
.apply(InfixOperator.EQUALS, Models.toLiteral(f, 0L))
.toExpression(),
f.newBlock(new ExpressionBuilder(f, f.newThis())
.method(NAME_SKIP_HEADER, fragmentInput)
.toStatement())));
}
SimpleName parser = f.newSimpleName("parser");
statements.add(new TypeBuilder(f, context.resolve(TsvParser.class))
.newObject(new TypeBuilder(f, context.resolve(InputStreamReader.class))
.newObject(fragmentInput, Models.toLiteral(f, conf.getCharsetName()))
.toExpression())
.toLocalVariableDeclaration(context.resolve(TsvParser.class), parser));
List<Expression> arguments = Lists.create();
arguments.add(parser);
if (hasFileName()) {
arguments.add(new TypeBuilder(f, context.resolve(StringOption.class))
.newObject(path)
.toExpression());
}
statements.add(new TypeBuilder(f, f.newNamedType(f.newSimpleName(NAME_READER)))
.newObject(arguments)
.toReturnStatement());
MethodDeclaration decl = f.newMethodDeclaration(
null,
new AttributeBuilder(f)