Interpreter.Utils
Class NewOutputBuffer
java.lang.Object
|
+--java.io.Writer
|
+--java.io.BufferedWriter
|
+--Interpreter.Utils.OutputBuffer
|
+--Interpreter.Utils.NewOutputBuffer
- public class NewOutputBuffer
- extends OutputBuffer
Buffer di output che estende le funzionalità del BufferedWriter.
Come l'OutputBuffer permette di utilizzare i comuni comandi print e println.
La differenza è che NewOutputBuffer aggiunge un newline in più per essere sicuri che
il buffer venga svuotato (la flush non è sufficiente in certi casi).
Il carattere di newline inserito è quello che viene consumato dallo stream come
carattere di fine input.
Fields inherited from class java.io.Writer |
lock |
Constructor Summary |
NewOutputBuffer(java.io.OutputStream Out)
Costruisce un nuovo NewOutputBuffer. |
NewOutputBuffer(java.io.Writer w)
Costruisce un nuovo NewOutputBuffer. |
Method Summary |
void |
print(java.lang.String s)
Scrive la stringa s sull'output buffer ed aggiunge un new line.
|
void |
println(java.lang.String s)
Scrive la stringa s sull'output buffer ed aggiunge due new line.
|
Methods inherited from class java.io.BufferedWriter |
close,
flush,
newLine,
write,
write,
write |
Methods inherited from class java.io.Writer |
write,
write |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
NewOutputBuffer
public NewOutputBuffer(java.io.Writer w)
- Costruisce un nuovo NewOutputBuffer.
- Parameters:
w
- lo stream che deve essere bufferizzato.
NewOutputBuffer
public NewOutputBuffer(java.io.OutputStream Out)
- Costruisce un nuovo NewOutputBuffer.
- Parameters:
Out
- lo stream che deve essere bufferizzato.
print
public void print(java.lang.String s)
throws InterpreterException
- Scrive la stringa s sull'output buffer ed aggiunge un new line.
Al termine fa un flush del buffer.
- Parameters:
s
- la stringa che deve essere scritta.- Throws:
- InterpreterException - se la scrittura non ha successo
- Overrides:
- print in class OutputBuffer
println
public void println(java.lang.String s)
throws InterpreterException
- Scrive la stringa s sull'output buffer ed aggiunge due new line.
Al termine fa un flush del buffer.
- Parameters:
s
- la stringa che deve essere scritta.- Throws:
- InterpreterException - se la scrittura non ha successo
- Overrides:
- println in class OutputBuffer
Codice realizzato da Francesco Geri & Marco Tamanti