Java Doc for WriteStream.java in  » EJB-Server-resin-3.1.5 » util » com » caucho » vfs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server resin 3.1.5 » util » com.caucho.vfs 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.caucho.vfs.OutputStreamWithBuffer
   com.caucho.vfs.WriteStream

All known Subclasses:   com.caucho.vfs.NullWriteStream,
WriteStream
public class WriteStream extends OutputStreamWithBuffer implements LockableStream(Code)
A fast bufferered output stream supporting both character and byte data. The underlying stream sources are provided by StreamImpl classes, so all streams have the same API regardless of the underlying implementation.

OutputStream and Writers are combined. The write routines write bytes and the print routines write characters.

Most applications will use the Path routines to create their own streams. Specialized applications, like servers, need the capability of recycling streams.




Constructor Summary
public  WriteStream()
     Creates an uninitialized stream.
public  WriteStream(StreamImpl source)
     Creates a stream and initializes with a specified source.

Method Summary
public  booleancanWrite()
     Returns true if the buffer allows writes.
public  voidclearWrite()
    
final public  voidclose()
     Close the stream, first flushing the write buffer.
public  voidflush()
     Flushes the buffer to the source.
public  voidflushBuffer()
     Flushes the buffer to the source.
public  voidflushToDisk()
    
final public  voidfree()
    
public  ObjectgetAttribute(String name)
     Returns a named attribute.
public  IteratorgetAttributeNames()
     Lists all named attributes.
public  byte[]getBuffer()
     Returns the write buffer.
public  intgetBufferOffset()
     Returns the write offset.
public  intgetBufferSize()
     Returns the write size.
public  booleangetDisableClose()
    
public  StringgetEncoding()
     Returns the mime-encoding used for writing.
public  StringgetJavaEncoding()
    
public  StringgetNewlineString()
    
public  PathgetPath()
     Returns the Path which opened this stream.
public  PrintWritergetPrintWriter()
     Returns a printWriter writing to this stream.
public  intgetRemaining()
     Returns the bytes remaining in the buffer.
public  StreamImplgetSource()
     Returns the underlying source for the stream.
public  StringgetUserPath()
     Returns the user path which opened this stream.
public  voidinit(StreamImpl source)
     Initializes the stream with a given source.
final public  booleanisClosed()
     Returns true if the stream is closed.
public  booleanlock(boolean shared, boolean block)
    
final public  voidlog(String string)
     Logs a line to the stream.
final public  voidlog(Throwable exn)
    
public  byte[]nextBuffer(int offset)
    
final public  voidprint(char[] buffer, int offset, int length)
     Prints the character buffer to the stream.
final public  voidprint(char ch)
     Prints the character buffer to the stream.
final public  voidprint(char[] buffer)
     Prints the character buffer to the stream.
final public  voidprint(CharSegment segment)
     Prints the character buffer to the stream.
final public  voidprint(String string)
     Prints a string.
final public  voidprint(String string, int offset, int length)
     Prints a substring.
final public  voidprint(boolean b)
     Prints a boolean.
final public  voidprint(int i)
     Prints an integer.
final public  voidprint(long i)
     Prints a long.
final public  voidprint(float f)
     Prints a float.
final public  voidprint(double d)
    
final public  voidprint(Object o)
    
final public  voidprintln()
    
final public  voidprintln(char[] buf, int offset, int length)
     Prints a character buffer followed by a newline.
final public  voidprintln(String string)
     Prints a string buffer followed by a newline.
final public  voidprintln(boolean b)
     Prints a boolean followed by a newline.
final public  voidprintln(char ch)
     Prints a char followed by a newline.
final public  voidprintln(int i)
     Prints an integer followed by a newline.
final public  voidprintln(long l)
     Prints a long followed by a newline.
final public  voidprintln(float f)
     Prints a float followed by a newline.
final public  voidprintln(double d)
     Prints a double followed by a newline.
final public  voidprintln(Object o)
     Prints an object, converted to a string, followed by a newline.
public  voidpushFilter(StreamFilter filter)
     Pushes a filter on the top of the stream stack.
public  voidremoveAttribute(String name)
     Removes a named attribute.
public  voidseekEnd(long offset)
    
public  voidseekStart(long offset)
    
public  voidsetAttribute(String name, Object value)
     Sets a named attribute.
public  voidsetBufferOffset(int offset)
     Sets the write offset.
public  voidsetDisableClose(boolean disableClose)
     Disables close.
public  voidsetDisableCloseSource(boolean disableClose)
     Disables close of the underlying source.
public  voidsetEncoding(String encoding)
     Sets the character encoding for writing to this stream.
public  voidsetFlushOnNewline(boolean flushOnNewline)
     Some streams, like log streams, should be flushed on every println call.
public  voidsetImplicitFlush(boolean implicitFlush)
    
public  voidsetLocale(Locale locale)
    
public  voidsetNewlineString(String newline)
    
public  voidsetPath(Path path)
     Sets a path name associated with the stream.
public  voidsetReuseBuffer(boolean reuse)
    
public static  voidsetSystemNewline(String newline)
     For testing, sets the system newlines.
public  booleanunlock()
    
public  voidwrite(int ch)
     Writes a byte.
public  voidwrite(byte[] buf, int offset, int length)
    
public  voidwrite(byte[] buf)
     Writes a byte array.
public  voidwriteFile(Path path)
     Copies a file to the stream.
public  longwriteStream(InputStream source)
     Writes the contents of a JDK stream.
public  voidwriteStream(Reader reader)
     Writes the contents of a JDK reader.
public  voidwriteStream(InputStream source, int totalLength)
     Writes the contents of a JDK stream.
public  voidwriteStream(StreamImpl source)
     Writes the contents of a JDK stream.


Constructor Detail
WriteStream
public WriteStream()(Code)
Creates an uninitialized stream. Use init to initialize.



WriteStream
public WriteStream(StreamImpl source)(Code)
Creates a stream and initializes with a specified source.
Parameters:
  source - Underlying source for the stream.




Method Detail
canWrite
public boolean canWrite()(Code)
Returns true if the buffer allows writes.

LogStreams, used for debugging, use this feature to test if they should write with very little overhead.

 if (dbg.canWrite())
 dbg.log("some debug value " + expensiveDebugCalculation(foo));
 



clearWrite
public void clearWrite()(Code)
Clears the write buffer



close
final public void close() throws IOException(Code)
Close the stream, first flushing the write buffer.



flush
public void flush() throws IOException(Code)
Flushes the buffer to the source.



flushBuffer
public void flushBuffer() throws IOException(Code)
Flushes the buffer to the source.



flushToDisk
public void flushToDisk() throws IOException(Code)
Flushes the buffer to the disk



free
final public void free()(Code)
Frees the buffer



getAttribute
public Object getAttribute(String name) throws IOException(Code)
Returns a named attribute. For example, an HTTP stream may use this to return header values.



getAttributeNames
public Iterator getAttributeNames() throws IOException(Code)
Lists all named attributes.



getBuffer
public byte[] getBuffer()(Code)
Returns the write buffer.



getBufferOffset
public int getBufferOffset()(Code)
Returns the write offset.



getBufferSize
public int getBufferSize()(Code)
Returns the write size.



getDisableClose
public boolean getDisableClose()(Code)



getEncoding
public String getEncoding()(Code)
Returns the mime-encoding used for writing.



getJavaEncoding
public String getJavaEncoding()(Code)



getNewlineString
public String getNewlineString()(Code)
Returns the current string used for println newlines



getPath
public Path getPath()(Code)
Returns the Path which opened this stream.



getPrintWriter
public PrintWriter getPrintWriter()(Code)
Returns a printWriter writing to this stream.



getRemaining
public int getRemaining()(Code)
Returns the bytes remaining in the buffer.



getSource
public StreamImpl getSource()(Code)
Returns the underlying source for the stream. the source



getUserPath
public String getUserPath()(Code)
Returns the user path which opened this stream.

Parsing routines typically use this for error reporting.




init
public void init(StreamImpl source)(Code)
Initializes the stream with a given source.
Parameters:
  source - Underlying source for the stream.



isClosed
final public boolean isClosed()(Code)
Returns true if the stream is closed.



lock
public boolean lock(boolean shared, boolean block)(Code)



log
final public void log(String string)(Code)
Logs a line to the stream. log is essentially println, but it doesn't throw an exception and it always flushes the output.



log
final public void log(Throwable exn)(Code)



nextBuffer
public byte[] nextBuffer(int offset) throws IOException(Code)
Flushes and writes the buffer



print
final public void print(char[] buffer, int offset, int length) throws IOException(Code)
Prints the character buffer to the stream.
Parameters:
  buffer - character buffer to write
Parameters:
  offset - offset into the buffer to start writes
Parameters:
  length - number of characters to write



print
final public void print(char ch) throws IOException(Code)
Prints the character buffer to the stream.
Parameters:
  ch - char



print
final public void print(char[] buffer) throws IOException(Code)
Prints the character buffer to the stream.
Parameters:
  buffer - character buffer to write



print
final public void print(CharSegment segment) throws IOException(Code)
Prints the character buffer to the stream.
Parameters:
  segment - character buffer to write



print
final public void print(String string) throws IOException(Code)
Prints a string.



print
final public void print(String string, int offset, int length) throws IOException(Code)
Prints a substring.
Parameters:
  string - the string to print
Parameters:
  offset - starting offset into the string
Parameters:
  length - length of the substring to print.



print
final public void print(boolean b) throws IOException(Code)
Prints a boolean.



print
final public void print(int i) throws IOException(Code)
Prints an integer.



print
final public void print(long i) throws IOException(Code)
Prints a long.



print
final public void print(float f) throws IOException(Code)
Prints a float.



print
final public void print(double d) throws IOException(Code)
Prints an double



print
final public void print(Object o) throws IOException(Code)
Prints a double, converted by String.valueOf()



println
final public void println() throws IOException(Code)
Prints a newline



println
final public void println(char[] buf, int offset, int length) throws IOException(Code)
Prints a character buffer followed by a newline.



println
final public void println(String string) throws IOException(Code)
Prints a string buffer followed by a newline.



println
final public void println(boolean b) throws IOException(Code)
Prints a boolean followed by a newline.



println
final public void println(char ch) throws IOException(Code)
Prints a char followed by a newline.



println
final public void println(int i) throws IOException(Code)
Prints an integer followed by a newline.



println
final public void println(long l) throws IOException(Code)
Prints a long followed by a newline.



println
final public void println(float f) throws IOException(Code)
Prints a float followed by a newline.



println
final public void println(double d) throws IOException(Code)
Prints a double followed by a newline.



println
final public void println(Object o) throws IOException(Code)
Prints an object, converted to a string, followed by a newline.



pushFilter
public void pushFilter(StreamFilter filter)(Code)
Pushes a filter on the top of the stream stack.
Parameters:
  filter - the filter to be added.



removeAttribute
public void removeAttribute(String name) throws IOException(Code)
Removes a named attribute.



seekEnd
public void seekEnd(long offset) throws IOException(Code)
Seeks based on the end



seekStart
public void seekStart(long offset) throws IOException(Code)
Seeks based on the start



setAttribute
public void setAttribute(String name, Object value) throws IOException(Code)
Sets a named attribute. For example, an HTTP stream may use this to set header values.



setBufferOffset
public void setBufferOffset(int offset)(Code)
Sets the write offset.



setDisableClose
public void setDisableClose(boolean disableClose)(Code)
Disables close. Sometimes an application will pass a stream to a client that may close the stream at an inappropriate time. Setting disable close gives the calling routine control over closing the stream.



setDisableCloseSource
public void setDisableCloseSource(boolean disableClose)(Code)
Disables close of the underlying source.



setEncoding
public void setEncoding(String encoding) throws UnsupportedEncodingException(Code)
Sets the character encoding for writing to this stream. Encoding can be a Java encoding or a mime-encoding.



setFlushOnNewline
public void setFlushOnNewline(boolean flushOnNewline)(Code)
Some streams, like log streams, should be flushed on every println call. Embedded newlines, i.e. '\n' in strings, do not trigger a flush.
Parameters:
  flushOnNewline - set to true if println flushes.



setImplicitFlush
public void setImplicitFlush(boolean implicitFlush)(Code)



setLocale
public void setLocale(Locale locale) throws UnsupportedEncodingException(Code)



setNewlineString
public void setNewlineString(String newline)(Code)
Sets the string to use for println newlines



setPath
public void setPath(Path path)(Code)
Sets a path name associated with the stream.



setReuseBuffer
public void setReuseBuffer(boolean reuse)(Code)



setSystemNewline
public static void setSystemNewline(String newline)(Code)
For testing, sets the system newlines.



unlock
public boolean unlock()(Code)



write
public void write(int ch) throws IOException(Code)
Writes a byte.



write
public void write(byte[] buf, int offset, int length) throws IOException(Code)
Writes a byte array



write
public void write(byte[] buf) throws IOException(Code)
Writes a byte array.



writeFile
public void writeFile(Path path) throws IOException(Code)
Copies a file to the stream.
Parameters:
  path - Path of the file to copy.



writeStream
public long writeStream(InputStream source) throws IOException(Code)
Writes the contents of a JDK stream. Essentially this will copy source to the current stream.
Parameters:
  source - InputStream to read.



writeStream
public void writeStream(Reader reader) throws IOException(Code)
Writes the contents of a JDK reader. Essentially this will copy source to the current stream.
Parameters:
  source - InputStream to read.



writeStream
public void writeStream(InputStream source, int totalLength) throws IOException(Code)
Writes the contents of a JDK stream. Essentially this will copy source to the current stream.
Parameters:
  source - InputStream to read.



writeStream
public void writeStream(StreamImpl source) throws IOException(Code)
Writes the contents of a JDK stream. Essentially this will copy source to the current stream.
Parameters:
  source - InputStream to read.



Methods inherited from com.caucho.vfs.OutputStreamWithBuffer
abstract public byte[] getBuffer() throws IOException(Code)(Java Doc)
abstract public int getBufferOffset() throws IOException(Code)(Java Doc)
abstract public byte[] nextBuffer(int offset) throws IOException(Code)(Java Doc)
abstract public void setBufferOffset(int offset) throws IOException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.