Reader

public abstract class Reader implement  Readable , closeable


IOException: read()、skip()、ready()、close()、

mark(If the stream does not support mark operation)

reset()If the stream has not been marked, or if the mark has been invalidated, or if the stream does not support reset(),


subclass must override : read(char[] , int ,int ) close() markSupport()

 

blocked while invoking : read (util some input is available , an I/O error occurs ,or the end of the stream is reached)                       

                                      skip(util some characters ara available ,an I/O error occurs , or the end of the stream reached)


Abstract class for reading character streams. The only methods that a subclass must implement areread(char[] , int , int )and close()。Most subclasses ,however ,will overrite some of themethods defined here in order to provide higher efficiently , additional functionality ,or both 



protected Object lock:    

The object used to synchronized operations on the stream 

protected Reader():

Create a new character-stream reader whose critical sections will sychronized on the reader itselt

protected Reader(Object lock)

Create a new character-stream reader whose critical section willsychronized on the given object



public int read(CharBuffer target) throws IOException

Attempts to read characters into the specified characterbuffer. Thebuffer used as a repository(储藏室)of the characters as-is:the onlychanges made are the results of a put operation

return : The number of the characters added to the buffer ,or -1 if the sourcs of characters is at its end



public int read() throws IOException

Read a single character The method will block util a character is avaiable ,an I/O error occurs , or the end of the stream is reached


public  abstract int read(char[] cbuf , int off , int len) throws IOException

Reads charactrers into a portion of an array .This method will block util some input is available , an I/O error occurs ,or the end of the stream is reached

off:Offset at which to start storing characters


public abstract void close() throws IOException

CLoses the stream and releases any system resources associated with it.Once the stream has been closed , further read() , ready(),mark(),reset(),orskip() invocations wilthrow an IOException.Close a previously closed stream has no effect

Specifiedby: close in the interface Closeable  and close in the AutoCLoseable



public long skip(int n) throws IOException

Skips(跳过,略过) character.This method will block util some characters ara available ,an I/O error occurs , or the end of the stream reached

n:The number of characters to skip

return:The number of   characters actually skip

throws:IllegalArgumentException if n<0


public  boolean ready() throws IOException

Tells(判断)wheather this stream is ready to read

reaturn:True:if the next read(0is guaranteed not to block for input 

note that:reutrn false does not guarantee the next read will block


public void mark(int readAheadLimit) throws IOException

Marks the present position in the stream,Subsequence(接下来随后)calls toreset()will attemptto reposition the stream to this point,Not all character-input streams support the mark() operation

Parameters:Limit on the number of the characters that may be read while still preserving the mark.After reading this many characters , attempting to reset the stream may fail

Throws:If the stream does not support mark() or if some other I/O error occurs



public boolean markSupported() 

Tells wheather this stream supports the mark() operation The default implementation always returns false .Subclasses should override this method



public void reset() throws IOException

Resets the stream, IF the stream has been marked , then attempt to repasition it to the mark .If the stream has not been marked , then attemot to reset it in some way approciation to the particular stream for example by repositioning it to its starting point Not alll charcter-input streams support the reset() operation , and some support reset() without supportng mark()

Throws:If the stream has not been marked , or if the maok has been invalidated , or if the stream doen not support reset() or some other I/O error occurs


**Koodo Reader是一个开源免费的电子书阅读器**。 它支持多种电子书格式,并且内置了笔记、高亮、翻译等功能,这些功能使得用户在阅读电子书籍时能够有更好的体验和便利性。作为一个可以在PC端或服务器上安装的应用程序,Koodo Reader为用户提供了一个跨平台的阅读环境。 以下是关于Koodo Reader的一些详细介绍: 1. **支持多种格式**:Koodo Reader能够支持常见的电子书格式,这使得用户可以阅读不同来源的电子书籍而无需担心格式不兼容的问题。 2. **笔记和高亮功能**:在阅读过程中,用户可以通过内置的笔记和高亮功能来标记重要内容,这对于学习和复习特别有帮助。 3. **内置翻译功能**:对于外语书籍,Koodo Reader提供了翻译功能,这可以帮助用户更好地理解文本内容。 4. **数据备份与恢复**:为了保护用户的阅读进度和笔记,Koodo Reader提供了备份与恢复的功能,确保数据不会意外丢失。 5. **跨平台使用**:无论是在个人电脑还是服务器上,Koodo Reader都能够安装和使用,这为用户提供了极大的灵活性。 6. **免费且开源**:作为一个免费且开源的软件,Koodo Reader不仅为用户提供了免费使用的优势,还允许开发者参与到软件的改进和功能扩展中去。 通过上述介绍,可以看出Koodo Reader是一个功能强大且用户友好的电子书阅读器,它不仅能够满足基本的阅读需求,还能够提供额外的学习辅助功能。如果你是一个电子书爱好者或者经常需要阅读大量的电子文档,那么Koodo Reader可能会是一个不错的选择。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值