com.smartwerkz.jupload.classic.files.links
Class SmallEndianAccessFile

java.lang.Object
  extended by com.smartwerkz.jupload.classic.files.links.SmallEndianAccessFile
All Implemented Interfaces:
java.io.DataInput

public class SmallEndianAccessFile
extends java.lang.Object
implements java.io.DataInput

Used to read all numeric values from a file with the least significant byte first. Those are eg used in the window's .lnk files.

Since:
19-Apr-2006, 11:35:02 PM
Author:
Dominik Seifert

Field Summary
 java.io.RandomAccessFile stream
           
 
Constructor Summary
SmallEndianAccessFile(java.io.File file, java.lang.String mode)
           
SmallEndianAccessFile(java.lang.String name, java.lang.String mode)
           
 
Method Summary
 int read()
           
 java.lang.String readAscii()
           
 java.lang.String readAscii(int length)
           
 boolean readBoolean()
           
 byte readByte()
           
 char readChar()
           
 double readDouble()
          Reads a double from this file.
 float readFloat()
          Reads a float from this file.
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
 int readInt()
           
 java.lang.String readLine()
           
 long readLong()
           
 short readShort()
           
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 java.lang.String readUTF()
           
 java.lang.String readUTF(int len)
           
 void seek(long pos)
           
 int skipBytes(int n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stream

public final java.io.RandomAccessFile stream
Constructor Detail

SmallEndianAccessFile

public SmallEndianAccessFile(java.io.File file,
                             java.lang.String mode)
                      throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException

SmallEndianAccessFile

public SmallEndianAccessFile(java.lang.String name,
                             java.lang.String mode)
                      throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException
Method Detail

read

public int read()
         throws java.io.IOException
Throws:
java.io.IOException

readUTF

public java.lang.String readUTF()
                         throws java.io.IOException
Specified by:
readUTF in interface java.io.DataInput
Throws:
java.io.IOException

readUTF

public java.lang.String readUTF(int len)
                         throws java.io.IOException
Throws:
java.io.IOException

readAscii

public java.lang.String readAscii()
                           throws java.io.IOException
Throws:
java.io.IOException

readAscii

public java.lang.String readAscii(int length)
                           throws java.io.IOException
Throws:
java.io.IOException

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Specified by:
readLine in interface java.io.DataInput
Throws:
java.io.IOException

readFully

public void readFully(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

readFully

public void readFully(byte[] b)
               throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

skipBytes

public int skipBytes(int n)
              throws java.io.IOException
Specified by:
skipBytes in interface java.io.DataInput
Throws:
java.io.IOException

readBoolean

public boolean readBoolean()
                    throws java.io.IOException
Specified by:
readBoolean in interface java.io.DataInput
Throws:
java.io.IOException

readShort

public short readShort()
                throws java.io.IOException
Specified by:
readShort in interface java.io.DataInput
Throws:
java.io.IOException

readLong

public long readLong()
              throws java.io.IOException
Specified by:
readLong in interface java.io.DataInput
Throws:
java.io.IOException

readUnsignedShort

public int readUnsignedShort()
                      throws java.io.IOException
Specified by:
readUnsignedShort in interface java.io.DataInput
Throws:
java.io.IOException

readUnsignedByte

public int readUnsignedByte()
                     throws java.io.IOException
Specified by:
readUnsignedByte in interface java.io.DataInput
Throws:
java.io.IOException

readInt

public int readInt()
            throws java.io.IOException
Specified by:
readInt in interface java.io.DataInput
Throws:
java.io.IOException

readFloat

public final float readFloat()
                      throws java.io.IOException
Reads a float from this file. This method reads an int value, starting at the current file pointer, as if by the readInt method and then converts that int to a float using the intBitsToFloat method in class Float.

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.

Specified by:
readFloat in interface java.io.DataInput
Returns:
the next four bytes of this file, interpreted as a float.
Throws:
java.io.EOFException - if this file reaches the end before reading four bytes.
java.io.IOException - if an I/O error occurs.
See Also:
RandomAccessFile.readInt(), Float.intBitsToFloat(int)

readDouble

public final double readDouble()
                        throws java.io.IOException
Reads a double from this file. This method reads a long value, starting at the current file pointer, as if by the readLong method and then converts that long to a double using the longBitsToDouble method in class Double.

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.

Specified by:
readDouble in interface java.io.DataInput
Returns:
the next eight bytes of this file, interpreted as a double.
Throws:
java.io.EOFException - if this file reaches the end before reading eight bytes.
java.io.IOException - if an I/O error occurs.
See Also:
RandomAccessFile.readLong(), Double.longBitsToDouble(long)

readChar

public char readChar()
              throws java.io.IOException
Specified by:
readChar in interface java.io.DataInput
Throws:
java.io.IOException

readByte

public byte readByte()
              throws java.io.IOException
Specified by:
readByte in interface java.io.DataInput
Throws:
java.io.IOException

seek

public void seek(long pos)
          throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2007 smartwerkz.com. All Rights Reserved.