public class WrapWriter
extends java.io.Writer
Constructor and Description |
---|
WrapWriter(java.io.OutputStream out)
Create a WrapWriter object that will write to a given stream.
|
WrapWriter(java.io.Writer out)
Create a WrapWriter object that will write to a given stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
int |
getCharsOnLineSoFar()
Get the number of characters that have been written so far
on the current line.
|
int |
getLeftMargin()
Get the position for the left margin for the text stream.
|
int |
getRightMargin()
Get the position for the right margin for the text stream.
|
void |
setLeftMargin(int m)
Set the position for the left margin for the text stream.
|
void |
setRightMargin(int m)
Set the position for the right margin for the text stream.
|
void |
write(char c)
Write a character to the stream.
|
void |
write(char[] cbuf,
int off,
int len) |
public WrapWriter(java.io.OutputStream out)
out
- the stream to which the WrapWriter will writepublic WrapWriter(java.io.Writer out)
out
- the stream to which the WrapWriter will writepublic void setLeftMargin(int m)
m
- the position for the left marginjava.lang.IllegalArgumentException
- if the value is negative or
greater than the current value of the right margingetLeftMargin()
public int getLeftMargin()
setLeftMargin(int)
public void setRightMargin(int m)
m
- the position for the right marginjava.lang.IllegalArgumentException
- if the value is
less than the current value of the left margingetRightMargin()
public int getRightMargin()
setRightMargin(int)
public int getCharsOnLineSoFar()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
public void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(char c) throws java.io.IOException
c
- the character to be writtenjava.io.IOException
- if there is a problem writing to the underlying streamCopyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.