Package org.apache.abdera.i18n.text.io
Class PipeChannel
- java.lang.Object
-
- org.apache.abdera.i18n.text.io.PipeChannel
-
- All Implemented Interfaces:
Closeable,Appendable,AutoCloseable,Readable,Channel,ReadableByteChannel,WritableByteChannel
@Deprecated(since="2021-07-29") public class PipeChannel extends Object implements ReadableByteChannel, WritableByteChannel, Appendable, Readable, 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(String charset)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Appendableappend(char c)Deprecated.Appendableappend(char c, String charset)Deprecated.Appendableappend(CharSequence csq)Deprecated.Appendableappend(CharSequence csq, int start, int end)Deprecated.Appendableappend(CharSequence csq, int start, int end, String charset)Deprecated.Appendableappend(CharSequence csq, String charset)Deprecated.voidclose()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 pipeInputStreamgetInputStream()Deprecated.Get an inputstream that can read from this pipe.CodepointIteratorgetIterator()Deprecated.Get a CodepointIterator that can iterate over unicode codepoints in this pipe.CodepointIteratorgetIterator(String charset)Deprecated.Get a CodepointIterator that can iterate over unicode codepoints in this pipe.OutputStreamgetOutputStream()Deprecated.Get an outputstream that can write to this pipe.ReadergetReader()Deprecated.Get a reader that can reader from this pipe.ReadergetReader(String charset)Deprecated.Get a reader that can reader from this pipe.WritergetWriter()Deprecated.Get a writer that can write to this pipe.WritergetWriter(String charset)Deprecated.Get a writer that can write to this pipe.booleanisOpen()Deprecated.True if the pipe is openbooleanisReadable()Deprecated.True if this pipe is readablebooleanisWritable()Deprecated.True if this pipe is writableintread(byte[] dst)Deprecated.Read from the pipe.intread(byte[] dst, int offset, int length)Deprecated.Read from the pipe.intread(ByteBuffer dst)Deprecated.Read from the pipe.intread(CharBuffer cb)Deprecated.intread(CharBuffer cb, String charset)Deprecated.voidreset()Deprecated.Reset the pipe.intwrite(byte[] src)Deprecated.Write to the pipeintwrite(byte[] src, int offset, int len)Deprecated.Write to the pipeintwrite(ByteBuffer src)Deprecated.Write to the pipe
-
-
-
Constructor Detail
-
PipeChannel
public PipeChannel()
Deprecated.
-
PipeChannel
public PipeChannel(String charset)
Deprecated.
-
-
Method Detail
-
getInputStream
public InputStream getInputStream()
Deprecated.Get an inputstream that can read from this pipe. The Pipe must be readable
-
getOutputStream
public OutputStream getOutputStream()
Deprecated.Get an outputstream that can write to this pipe. The Pipe must be writable
-
getWriter
public Writer getWriter()
Deprecated.Get a writer that can write to this pipe. The pipe must be writable
-
getWriter
public Writer getWriter(String charset)
Deprecated.Get a writer that can write to this pipe. The pipe must be writable
-
getReader
public Reader getReader(String charset)
Deprecated.Get a reader that can reader from this pipe. The pipe must be readable
-
getReader
public 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(String charset)
Deprecated.Get a CodepointIterator that can iterate over unicode codepoints in this pipe. The pipe must be readable
-
read
public int read(ByteBuffer dst) throws IOException
Deprecated.Read from the pipe.- Specified by:
readin interfaceReadableByteChannel- Throws:
IOException
-
read
public int read(byte[] dst) throws IOExceptionDeprecated.Read from the pipe.- Throws:
IOException
-
read
public int read(byte[] dst, int offset, int length) throws IOExceptionDeprecated.Read from the pipe.- Throws:
IOException
-
isOpen
public boolean isOpen()
Deprecated.True if the pipe is open
-
write
public int write(ByteBuffer src) throws IOException
Deprecated.Write to the pipe- Specified by:
writein interfaceWritableByteChannel- Throws:
IOException
-
write
public int write(byte[] src) throws IOExceptionDeprecated.Write to the pipe- Throws:
IOException
-
write
public int write(byte[] src, int offset, int len) throws IOExceptionDeprecated.Write to the pipe- Throws:
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 IOExceptionDeprecated.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:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
reset
public void reset()
Deprecated.Reset the pipe. Switches the pipe to writable mode
-
append
public Appendable append(CharSequence csq) throws IOException
Deprecated.- Specified by:
appendin interfaceAppendable- Throws:
IOException
-
append
public Appendable append(char c) throws IOException
Deprecated.- Specified by:
appendin interfaceAppendable- Throws:
IOException
-
append
public Appendable append(CharSequence csq, int start, int end) throws IOException
Deprecated.- Specified by:
appendin interfaceAppendable- Throws:
IOException
-
append
public Appendable append(CharSequence csq, String charset) throws IOException
Deprecated.- Throws:
IOException
-
append
public Appendable append(char c, String charset) throws IOException
Deprecated.- Throws:
IOException
-
append
public Appendable append(CharSequence csq, int start, int end, String charset) throws IOException
Deprecated.- Throws:
IOException
-
read
public int read(CharBuffer cb) throws IOException
Deprecated.- Specified by:
readin interfaceReadable- Throws:
IOException
-
read
public int read(CharBuffer cb, String charset) throws IOException
Deprecated.- Throws:
IOException
-
-