swisseph
クラス FilePtr

java.lang.Object
  上位を拡張 swisseph.FilePtr
すべての実装されたインタフェース:
java.io.Serializable

public class FilePtr
extends java.lang.Object
implements java.io.Serializable

This class is meant to be a wrapper to some read functionality of the RandomAccessFile class. It adds the ability to read (and search and seek) in files using http://... access. This is needed to allow applets read access to files, in this case the Swiss Ephemeris and JPL data files.

関連項目:
直列化された形式

フィールドの概要
static java.lang.String useragent
           
 
コンストラクタの概要
FilePtr(java.io.RandomAccessFile fp, java.net.Socket sk, java.io.InputStream is, java.io.BufferedOutputStream os, java.lang.String fnamp, long fileLength, int bufsize)
          Creates a new FilePtr instance.
 
メソッドの概要
 void close()
          Closes the connection to the file.
 long getFilePointer()
          Returns the current position of the file pointer.
 long length()
          Returns the length of the file.
 byte readByte()
          Reads one (signed) byte.
 double readDouble()
          Reads a double value.
 int readInt()
          Reads a (signed) integer value.
 java.lang.String readLine()
          Reads a complete line from the file.
 short readShort()
          Reads a (signed) short value.
 int readUnsignedByte()
          Reads one unsigned byte.
 void seek(long pos)
          Positions the file pointer.
 void setBigendian(boolean bigendian)
           
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

useragent

public static final java.lang.String useragent
関連項目:
定数フィールド値
コンストラクタの詳細

FilePtr

public FilePtr(java.io.RandomAccessFile fp,
               java.net.Socket sk,
               java.io.InputStream is,
               java.io.BufferedOutputStream os,
               java.lang.String fnamp,
               long fileLength,
               int bufsize)
        throws java.io.IOException
Creates a new FilePtr instance. Well, the parameters are rather "funny" for now, but there were reasons for it. I will change it later (hopefully)...
If you do not need to read randomly and you have access to the file directly, you should use the BufferedInputStream etc. -classes, as they are MUCH faster than the RandomAccessFile class that is used here.

例外:
java.io.IOException
メソッドの詳細

setBigendian

public void setBigendian(boolean bigendian)

readByte

public byte readByte()
              throws java.io.IOException,
                     java.io.EOFException
Reads one (signed) byte.

戻り値:
One signed 8 bit byte.
例外:
java.io.IOException - if an I/O error occurs.
java.io.EOFException - if the end of file is reached before the byte could be read.

readUnsignedByte

public int readUnsignedByte()
                     throws java.io.IOException,
                            java.io.EOFException
Reads one unsigned byte.

戻り値:
One unsigned 8 bit byte as an integer.
例外:
java.io.IOException - if an I/O error occurs.
java.io.EOFException - if the end of file is reached before the byte could be read.

readShort

public short readShort()
                throws java.io.IOException,
                       java.io.EOFException
Reads a (signed) short value. This is a two byte read (16 bits) with highest byte first.

戻り値:
A signed 2 byte (16 bit) value as a short.
例外:
java.io.IOException - if an I/O error occurs.
java.io.EOFException - if the end of file is reached before the 2 bytes could be read completely.

readInt

public int readInt()
            throws java.io.IOException,
                   java.io.EOFException
Reads a (signed) integer value. This is a four byte read (32 bits) with highest bytes first.

戻り値:
A signed 4 byte (32 bit) value as an integer.
例外:
java.io.IOException - if an I/O error occurs.
java.io.EOFException - if the end of file is reached before the 4 bytes could be read completely.

readDouble

public double readDouble()
                  throws java.io.IOException,
                         java.io.EOFException
Reads a double value. This is an 8 byte read (64 bits) with highest bytes first.

戻り値:
A double value.
例外:
java.io.IOException - if an I/O error occurs.
java.io.EOFException - if the end of file is reached before the 8 bytes could be read completely.

readLine

public java.lang.String readLine()
                          throws java.io.IOException,
                                 java.io.EOFException
Reads a complete line from the file. The line is seen to end on a newline character ('\n') or on an end of file. The returned String will include the newline character if any.

戻り値:
A String containing a complete line. The line may be 0 characters long.
例外:
java.io.IOException - if an I/O error occurs.
java.io.EOFException - if the end of file is reached before even one character (byte) could be read.

close

public void close()
           throws java.io.IOException
Closes the connection to the file. This includes any Streams as well as the Socket and the RandomAccessFile from the constructor.

例外:
java.io.IOException - if an I/O error occurs.

getFilePointer

public long getFilePointer()
Returns the current position of the file pointer.

戻り値:
the current position of the file pointer.

length

public long length()
            throws java.io.IOException
Returns the length of the file.

戻り値:
the length of the file in bytes.
例外:
java.io.IOException - if an I/O error occurs.

seek

public void seek(long pos)
Positions the file pointer.

パラメータ:
pos - the new position in the file. The position is seen zero based.