Top Description Fields Constructors Methods
org.droidparts.dexmaker.dx.util

public final Class IndentingWriter

extends FilterWriter
Class Inheritance
Imports
java.io.FilterWriter, .IOException, .Writer

Writer that wraps another writer and passes width-limited and optionally-prefixed output to its subordinate. When lines are wrapped they are automatically indented based on the start of the line.

Field Summary

Modifier and TypeField and Description
private boolean
collectingIndent

whether indent spaces are currently being collected

private int
column

>= 0; current output column (zero-based)

private int
indent

>= 0; current indent amount

private final int
maxIndent

> 0; the maximum indent

private final String
prefix

null-ok; optional prefix for every line

private final int
width

> 0; the maximum output width

Inherited from java.io.FilterWriter:
out

Constructor Summary

AccessConstructor and Description
public
IndentingWriter(Writer
non-null; writer to send final output to
out
,
int
>= 0; the maximum output width (not including prefix), or 0 for no maximum
width
,
String
non-null; the prefix for each line
prefix
)

Constructs an instance.

public
IndentingWriter(Writer
non-null; writer to send final output to
out
,
int
>= 0; the maximum output width (not including prefix), or 0 for no maximum
width
)

Constructs a no-prefix instance.

Method Summary

Modifier and TypeMethod and Description
private void
bol()

Indicates that output is at the beginning of a line.

public void
write(int
int specifying a character to be written
c
)

Overrides java.io.FilterWriter.write.

Writes a single character.
public void
write(char[]
Buffer of characters to be written
cbuf
,
int
Offset from which to start reading characters
off
,
int
Number of characters to be written
len
)

Overrides java.io.FilterWriter.write.

Writes a portion of an array of characters.
public void
write(String
String to be written
str
,
int
Offset from which to start reading characters
off
,
int
Number of characters to be written
len
)

Overrides java.io.FilterWriter.write.

Writes a portion of a string.
Inherited from java.io.FilterWriter:
closeflush

Field Detail

collectingIndentback to summary
private boolean collectingIndent

whether indent spaces are currently being collected

columnback to summary
private int column

>= 0; current output column (zero-based)

indentback to summary
private int indent

>= 0; current indent amount

maxIndentback to summary
private final int maxIndent

> 0; the maximum indent

prefixback to summary
private final String prefix

null-ok; optional prefix for every line

widthback to summary
private final int width

> 0; the maximum output width

Constructor Detail

IndentingWriterback to summary
public IndentingWriter(Writer out, int width, String prefix)

Constructs an instance.

Parameters
out:Writer

non-null; writer to send final output to

width:int

>= 0; the maximum output width (not including prefix), or 0 for no maximum

prefix:String

non-null; the prefix for each line

IndentingWriterback to summary
public IndentingWriter(Writer out, int width)

Constructs a no-prefix instance.

Parameters
out:Writer

non-null; writer to send final output to

width:int

>= 0; the maximum output width (not including prefix), or 0 for no maximum

Method Detail

bolback to summary
private void bol()

Indicates that output is at the beginning of a line.

writeback to summary
public void write(int c) throws IOException

Overrides java.io.FilterWriter.write.

Doc from java.io.FilterWriter.write.

Writes a single character.

Parameters
c:int

Doc from java.io.Writer.write.

int specifying a character to be written

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(char[] cbuf, int off, int len) throws IOException

Overrides java.io.FilterWriter.write.

Doc from java.io.FilterWriter.write.

Writes a portion of an array of characters.

Parameters
cbuf:char[]

Buffer of characters to be written

off:int

Offset from which to start reading characters

len:int

Number of characters to be written

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(String str, int off, int len) throws IOException

Overrides java.io.FilterWriter.write.

Doc from java.io.FilterWriter.write.

Writes a portion of a string.

Parameters
str:String

String to be written

off:int

Offset from which to start reading characters

len:int

Number of characters to be written

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs