⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jfreader.java

📁 用Java开发的、实现类似Visio功能的应用程序源码
💻 JAVA
字号:

/**
 *    $Id: JFReader.java $
 *
 *    Copyright 2004 ~ 2005 JingFei International Cooperation LTD. All rights reserved.
 *
 */
package com.jfimagine.utils.io;

import java.io.IOException;

 /**
 * JFReader is a reader interface to handle JFDraw files reading.
 *
 * @author     CookieMaker    
 *
 * @version $Revision: 1.6.0 $
 */ 

public interface JFReader {


    /**
     * Reads up to <code>len</code> bytes of data from the contained 
     * input stream into an array of bytes.  An attempt is made to read 
     * as many as <code>len</code> bytes, but a smaller number may be read, 
     * possibly zero. The number of bytes actually read is returned as an 
     * integer.
     *
     *
     * @param      b     the buffer into which the data is read.
     * @param      off   the start offset of the data.
     * @param      len   the maximum number of bytes read.
     * @return     the total number of bytes read into the buffer, or
     *             <code>-1</code> if there is no more data because the end
     *             of the stream has been reached.
     * @exception  IOException  if an I/O error occurs.
     */
    public int read(byte b[], int off, int len) throws IOException;
    	

    /**
     * Makes an attempt to skip over
     * <code>n</code> bytes
     * of data from the input
     * stream, discarding the skipped bytes. 
     *
     * The actual
     * number of bytes skipped is returned.
     *
     * @param      n   the number of bytes to be skipped.
     * @return     the number of bytes actually skipped.
     * @exception  IOException   if an I/O error occurs.
     */
    public int skipBytes(int n) throws IOException;

    /**
     * Reads one input byte and returns
     * <code>true</code> if that byte is nonzero,
     * <code>false</code> if that byte is zero.
     * This method is suitable for reading
     * the byte written by the <code>writeBoolean</code>
     * method in JFWriter.
     *
     * @return     the <code>boolean</code> value read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public boolean readBoolean() throws IOException;

    /**
     * Reads and returns one input byte.
     * The byte is treated as a signed value in
     *	
     * This method is suitable for
     * reading the byte written by the <code>writeByte</code>
     * method in JFWriter.
     *
     * @return     the 8-bit value read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public byte readByte() throws IOException;

    /**
     * Reads one input byte, zero-extends
     * it to type <code>int</code>, and returns
     * the result, which is therefore in the range
     * <code>0</code>
     * through <code>255</code>.
     * This method is suitable for reading
     * the byte written by the <code>writeByte</code>
     * method in JFWriter.
     *
     * @return     the unsigned 8-bit value read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public int readUnsignedByte() throws IOException;

    /**
     * Reads two input bytes and returns
     * a <code>short</code> value.
     *
     * This method
     * is suitable for reading the bytes written
     * by the <code>writeShort</code> method in JFWriter.
     *
     * @return     the 16-bit value read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public short readShort() throws IOException;

    /**
     * Reads two input bytes and returns
     * an <code>int</code> value in the range <code>0</code>
     * through <code>65535</code>. 
     *
     * This method is suitable for reading the bytes
     * written by the <code>writeShort</code> method in JFWriter.
     *
     * @return     the unsigned 16-bit value read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public int readUnsignedShort() throws IOException;

    /**
     * Reads an input <code>char</code> and returns the <code>char</code> value.
     *
     * This method
     * is suitable for reading bytes written by
     * the <code>writeChar</code> method in JFWriter.
     *
     * @return     the Unicode <code>char</code> read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public char readChar() throws IOException;

    /**
     * Reads four input bytes and returns an
     * <code>int</code> value. 
     *
     * This method is suitable
     * for reading bytes written by the <code>writeInt</code>
     * method in JFWriter.
     *
     * @return     the <code>int</code> value read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public int readInt() throws IOException;

    /**
     * Reads eight input bytes and returns
     * a <code>long</code> value. 
     *
     * This method is suitable
     * for reading bytes written by the <code>writeLong</code>
     * method in JFWriter.
     *
     * @return     the <code>long</code> value read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public long readLong() throws IOException;

    /**
     * Reads four input bytes and returns
     * a <code>float</code> value. 
     *
     * This method is suitable for reading
     * bytes written by the <code>writeFloat</code>
     * method in JFWriter.
     *
     * @return     the <code>float</code> value read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public float readFloat() throws IOException;

    /**
     * Reads eight input bytes and returns
     * a <code>double</code> value. 
     *
     * This method is suitable for reading
     * bytes written by the <code>writeDouble</code>
     * method in JFWriter.
     *
     * @return     the <code>double</code> value read.
     * @exception  EOFException  if this stream reaches the end before reading
     *               all the bytes.
     * @exception  IOException   if an I/O error occurs.
     */
    public double readDouble() throws IOException;


    /**
     * Reads in a string that has been encoded using a modified UTF-8 format.
     * <p>
     * The <code>writeUTF</code>
     * method in JFWriter may be used to write data that is suitable
     * for reading by this method.
     * @return     a Unicode string.
     * @exception  EOFException            if this stream reaches the end
     *               before reading all the bytes.
     * @exception  IOException             if an I/O error occurs.
     * @exception  UTFDataFormatException  if the bytes do not represent a
     *               valid UTF-8 encoding of a string.
     */
    public String readUTF() throws IOException;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -