Package org.apache.abdera.i18n.text.io
Class PipeChannel
- java.lang.Object
-
- org.apache.abdera.i18n.text.io.PipeChannel
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.Appendable
,java.lang.AutoCloseable
,java.lang.Readable
,java.nio.channels.Channel
,java.nio.channels.ReadableByteChannel
,java.nio.channels.WritableByteChannel
@Deprecated(since="2021-07-29") public class PipeChannel extends java.lang.Object implements java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel, java.lang.Appendable, java.lang.Readable, java.io.Closeable
Deprecated.This API is deprecated as Apache Abdera is a retired project since 2017.Implements a buffer that provides a slightly more efficient way of writing, and then reading a stream of bytes. To use: PipeChannel pipe = new PipeChannel(); byte[] bytes = {'a','b','c','d'}; pipe.write(bytes); pipe.close(); InputStream in = pipe.getInputStream(); int i = -1; while ((i = in.read()) != -1) {...} By default, closing will automatically cause it to flip over to Read mode, locking the buffer from further writes and setting the read position to 0. Once the Buffer has been fully read, it must be reset, which sets it back into write mode
-
-
Constructor Summary
Constructors Constructor Description PipeChannel()
Deprecated.PipeChannel(java.lang.String charset)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Appendable
append(char c)
Deprecated.java.lang.Appendable
append(char c, java.lang.String charset)
Deprecated.java.lang.Appendable
append(java.lang.CharSequence csq)
Deprecated.java.lang.Appendable
append(java.lang.CharSequence csq, int start, int end)
Deprecated.java.lang.Appendable
append(java.lang.CharSequence csq, int start, int end, java.lang.String charset)
Deprecated.java.lang.Appendable
append(java.lang.CharSequence csq, java.lang.String charset)
Deprecated.void
close()
Deprecated.If the pipe is writable, this will close the input and switch to readable mode If the pipe is readable, this will close the output and reset the pipejava.io.InputStream
getInputStream()
Deprecated.Get an inputstream that can read from this pipe.CodepointIterator
getIterator()
Deprecated.Get a CodepointIterator that can iterate over unicode codepoints in this pipe.CodepointIterator
getIterator(java.lang.String charset)
Deprecated.Get a CodepointIterator that can iterate over unicode codepoints in this pipe.java.io.OutputStream
getOutputStream()
Deprecated.Get an outputstream that can write to this pipe.java.io.Reader
getReader()
Deprecated.Get a reader that can reader from this pipe.java.io.Reader
getReader(java.lang.String charset)
Deprecated.Get a reader that can reader from this pipe.java.io.Writer
getWriter()
Deprecated.Get a writer that can write to this pipe.java.io.Writer
getWriter(java.lang.String charset)
Deprecated.Get a writer that can write to this pipe.boolean
isOpen()
Deprecated.True if the pipe is openboolean
isReadable()
Deprecated.True if this pipe is readableboolean
isWritable()
Deprecated.True if this pipe is writableint
read(byte[] dst)
Deprecated.Read from the pipe.int
read(byte[] dst, int offset, int length)
Deprecated.Read from the pipe.int
read(java.nio.ByteBuffer dst)
Deprecated.Read from the pipe.int
read(java.nio.CharBuffer cb)
Deprecated.int
read(java.nio.CharBuffer cb, java.lang.String charset)
Deprecated.void
reset()
Deprecated.Reset the pipe.int
write(byte[] src)
Deprecated.Write to the pipeint
write(byte[] src, int offset, int len)
Deprecated.Write to the pipeint
write(java.nio.ByteBuffer src)
Deprecated.Write to the pipe
-
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream()
Deprecated.Get an inputstream that can read from this pipe. The Pipe must be readable
-
getOutputStream
public java.io.OutputStream getOutputStream()
Deprecated.Get an outputstream that can write to this pipe. The Pipe must be writable
-
getWriter
public java.io.Writer getWriter()
Deprecated.Get a writer that can write to this pipe. The pipe must be writable
-
getWriter
public java.io.Writer getWriter(java.lang.String charset)
Deprecated.Get a writer that can write to this pipe. The pipe must be writable
-
getReader
public java.io.Reader getReader(java.lang.String charset)
Deprecated.Get a reader that can reader from this pipe. The pipe must be readable
-
getReader
public java.io.Reader getReader()
Deprecated.Get a reader that can reader from this pipe. The pipe must be readable
-
getIterator
public CodepointIterator getIterator()
Deprecated.Get a CodepointIterator that can iterate over unicode codepoints in this pipe. The pipe must be readable
-
getIterator
public CodepointIterator getIterator(java.lang.String charset)
Deprecated.Get a CodepointIterator that can iterate over unicode codepoints in this pipe. The pipe must be readable
-
read
public int read(java.nio.ByteBuffer dst) throws java.io.IOException
Deprecated.Read from the pipe.- Specified by:
read
in interfacejava.nio.channels.ReadableByteChannel
- Throws:
java.io.IOException
-
read
public int read(byte[] dst) throws java.io.IOException
Deprecated.Read from the pipe.- Throws:
java.io.IOException
-
read
public int read(byte[] dst, int offset, int length) throws java.io.IOException
Deprecated.Read from the pipe.- Throws:
java.io.IOException
-
isOpen
public boolean isOpen()
Deprecated.True if the pipe is open- Specified by:
isOpen
in interfacejava.nio.channels.Channel
-
write
public int write(java.nio.ByteBuffer src) throws java.io.IOException
Deprecated.Write to the pipe- Specified by:
write
in interfacejava.nio.channels.WritableByteChannel
- Throws:
java.io.IOException
-
write
public int write(byte[] src) throws java.io.IOException
Deprecated.Write to the pipe- Throws:
java.io.IOException
-
write
public int write(byte[] src, int offset, int len) throws java.io.IOException
Deprecated.Write to the pipe- Throws:
java.io.IOException
-
isReadable
public boolean isReadable()
Deprecated.True if this pipe is readable
-
isWritable
public boolean isWritable()
Deprecated.True if this pipe is writable
-
close
public void close() throws java.io.IOException
Deprecated.If the pipe is writable, this will close the input and switch to readable mode If the pipe is readable, this will close the output and reset the pipe- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.nio.channels.Channel
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
reset
public void reset()
Deprecated.Reset the pipe. Switches the pipe to writable mode
-
append
public java.lang.Appendable append(java.lang.CharSequence csq) throws java.io.IOException
Deprecated.- Specified by:
append
in interfacejava.lang.Appendable
- Throws:
java.io.IOException
-
append
public java.lang.Appendable append(char c) throws java.io.IOException
Deprecated.- Specified by:
append
in interfacejava.lang.Appendable
- Throws:
java.io.IOException
-
append
public java.lang.Appendable append(java.lang.CharSequence csq, int start, int end) throws java.io.IOException
Deprecated.- Specified by:
append
in interfacejava.lang.Appendable
- Throws:
java.io.IOException
-
append
public java.lang.Appendable append(java.lang.CharSequence csq, java.lang.String charset) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
append
public java.lang.Appendable append(char c, java.lang.String charset) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
append
public java.lang.Appendable append(java.lang.CharSequence csq, int start, int end, java.lang.String charset) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
read
public int read(java.nio.CharBuffer cb) throws java.io.IOException
Deprecated.- Specified by:
read
in interfacejava.lang.Readable
- Throws:
java.io.IOException
-
read
public int read(java.nio.CharBuffer cb, java.lang.String charset) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
-