cds.aladin
Class MyInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by cds.aladin.MyInputStream
All Implemented Interfaces:
java.io.Closeable

public final class MyInputStream
extends java.io.FilterInputStream

Plan dedie au stream.

Version:
1.4 : (oct 2006) support de la calib dans l'entête JPEG, 1.3 : (été 2006) support de Sectractor, 1.2 : (mai 2005) correction bug inTSV() et suppression AJSx, 1.1 : (avril 2005) correction bug lookForSignature(), 1.1 : (fév 2005) GIF, 1.0 : (16 juin 2003) creation
Author:
Pierre Fernique [CDS]

Field Summary
static long AIPSTABLE
           
static long AJ
           
static long AJS
           
static long AJSx
           
static long ASTRORES
           
static long BMP
           
static long BSV
           
static long CATLIST
           
static long CSV
           
static long CUBE
           
static long FITS
           
static long FITSB
           
static long FITST
           
static long FOV
           
static long FOV_ONLY
           
static long GIF
           
static long GZ
           
static long HCOMP
           
static long HPX
           
static long HUGE
           
static long IDHA
           
static long IPAC
           
static long JPEG
           
static long MRCOMP
           
static long NOTAVAILABLE
           
static long PNG
           
static long RGB
           
static long RICE
           
static long SEXTRA
           
static long SIA_SSA
           
static long UNKNOWN
           
static long VOTABLE
           
static long XFITS
           
static long XML
           
 
Constructor Summary
MyInputStream(java.io.InputStream in)
           
 
Method Summary
 int available()
          Interface InputStream, methode available()
static java.lang.String decodeType(long type)
          Affichage "en clair" du type de fichier en fonction du cahmp de bits retourne par getType()
 long getPos()
          Retourne la position du prochain octet qui va être lu dans le flux
 java.lang.String gets()
          Retourne la prochaine ligne du stream
 long getType()
          Determine le type de fichier.
 boolean isGZ()
          Juste pour tester s'il s'agit d'un flux gzipé
static void main(java.lang.String[] args)
           
 boolean markSupported()
          Interface InputStream, methode markSupported()
 int read()
          Interface InputStream, methode read() LA METHODE EST UN PEU BOEUF CAR JE PASSE PAR UN TABLEAU DE 1 OCTET.
 int read(byte[] buf)
          Interface InputStream, methode read(byte buf[]) Remplit au mieux le tableau passe en parametre.
 int read(byte[] buf, int offset, int len)
          Interface InputStream, methode read(byte bbuf[],int offset,int len) Remplit au mieux le tableau passe en parametre.
 byte[] readFully()
          Lecture de la totalite du flux dans un tableau de bytes sans savoir a priori la taille du flux La lecture se fait dans un vecteur de blocs que l'on concatene a la fin de la lecture
 void readFully(byte[] buf)
          Remplit le tableau passe en parametre d'un nombre precis d'octets.
 void readFully(byte[] buf, int offset, int len)
          Remplit le tableau passe en parametre d'un nombre precis d'octets.
 void resetType()
          Reset le type courant du flux en ne conservant que GZIP et FITS_EXTENSION. => our analyse des fichiers en FITS EXTENSION
 long skip(long n)
          Interface InputStream, methode skip()
 MyInputStream startRead()
          Dans le cas ou le flux peut etre gzippe, il est necessaire de passer par cette methode pour un eventuel "empilement" de l'objet MyInputStream.
 
Methods inherited from class java.io.FilterInputStream
close, mark, reset
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final long UNKNOWN
See Also:
Constant Field Values

FITS

public static final long FITS
See Also:
Constant Field Values

JPEG

public static final long JPEG
See Also:
Constant Field Values

GIF

public static final long GIF
See Also:
Constant Field Values

MRCOMP

public static final long MRCOMP
See Also:
Constant Field Values

HCOMP

public static final long HCOMP
See Also:
Constant Field Values

GZ

public static final long GZ
See Also:
Constant Field Values

XML

public static final long XML
See Also:
Constant Field Values

ASTRORES

public static final long ASTRORES
See Also:
Constant Field Values

VOTABLE

public static final long VOTABLE
See Also:
Constant Field Values

AJ

public static final long AJ
See Also:
Constant Field Values

AJS

public static final long AJS
See Also:
Constant Field Values

IDHA

public static final long IDHA
See Also:
Constant Field Values

SIA_SSA

public static final long SIA_SSA
See Also:
Constant Field Values

CSV

public static final long CSV
See Also:
Constant Field Values

NOTAVAILABLE

public static final long NOTAVAILABLE
See Also:
Constant Field Values

AJSx

public static final long AJSx
See Also:
Constant Field Values

PNG

public static final long PNG
See Also:
Constant Field Values

XFITS

public static final long XFITS
See Also:
Constant Field Values

FOV

public static final long FOV
See Also:
Constant Field Values

FOV_ONLY

public static final long FOV_ONLY
See Also:
Constant Field Values

CATLIST

public static final long CATLIST
See Also:
Constant Field Values

RGB

public static final long RGB
See Also:
Constant Field Values

BSV

public static final long BSV
See Also:
Constant Field Values

FITST

public static final long FITST
See Also:
Constant Field Values

FITSB

public static final long FITSB
See Also:
Constant Field Values

CUBE

public static final long CUBE
See Also:
Constant Field Values

SEXTRA

public static final long SEXTRA
See Also:
Constant Field Values

HUGE

public static final long HUGE
See Also:
Constant Field Values

AIPSTABLE

public static final long AIPSTABLE
See Also:
Constant Field Values

IPAC

public static final long IPAC
See Also:
Constant Field Values

BMP

public static final long BMP
See Also:
Constant Field Values

RICE

public static final long RICE
See Also:
Constant Field Values

HPX

public static final long HPX
See Also:
Constant Field Values
Constructor Detail

MyInputStream

public MyInputStream(java.io.InputStream in)
              throws java.io.IOException
Throws:
java.io.IOException
Method Detail

startRead

public MyInputStream startRead()
                        throws java.io.IOException
Dans le cas ou le flux peut etre gzippe, il est necessaire de passer par cette methode pour un eventuel "empilement" de l'objet MyInputStream. S'utilise typiquement: f=f.startRead();

Returns:
le flux lui-meme, ou un nouveau flux s'il s'agit d'un flux gzippe
Throws:
java.io.IOException

getPos

public long getPos()
Retourne la position du prochain octet qui va être lu dans le flux

Returns:
position du prochain octet qui sera lu (commence à 0)

resetType

public void resetType()
Reset le type courant du flux en ne conservant que GZIP et FITS_EXTENSION. => our analyse des fichiers en FITS EXTENSION


isGZ

public boolean isGZ()
             throws java.io.IOException
Juste pour tester s'il s'agit d'un flux gzipé

Throws:
java.io.IOException

getType

public long getType()
             throws java.io.IOException
Determine le type de fichier. Met a jour un champ de bit ou chaque bit decrit un type. Cette methode ne peut etre appelee si le stream a deja ete entame. Le champ de bit peut etre affiche en langage naturelle par la methode decodeType().

Returns:
un champ de bit decrivant le type de fichier
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Interface InputStream, methode skip()

Overrides:
skip in class java.io.FilterInputStream
Parameters:
n - le nombre d'octets a skipper
Returns:
le nombre d'octets effectivement skippes
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Interface InputStream, methode available()

Overrides:
available in class java.io.FilterInputStream
Returns:
le nombre d'octets disponibles
Throws:
java.io.IOException

markSupported

public boolean markSupported()
Interface InputStream, methode markSupported()

Overrides:
markSupported in class java.io.FilterInputStream
Returns:
toujours false car MyInputStream ne supporte pas les marks

read

public int read()
         throws java.io.IOException
Interface InputStream, methode read() LA METHODE EST UN PEU BOEUF CAR JE PASSE PAR UN TABLEAU DE 1 OCTET. POUR EVITER LES ALLOCATIONS JE METS CE TABLEAU EN INSTANCE DE CLASSE

Overrides:
read in class java.io.FilterInputStream
Returns:
retourne le prochain octet disponible dans le flux sous la forme d'un entier.
Throws:
java.io.IOException

read

public int read(byte[] buf)
         throws java.io.IOException
Interface InputStream, methode read(byte buf[]) Remplit au mieux le tableau passe en parametre.

Overrides:
read in class java.io.FilterInputStream
Parameters:
le - buffer a remplir
le - nombre d'octets effectivement lus
Throws:
java.io.IOException

read

public int read(byte[] buf,
                int offset,
                int len)
         throws java.io.IOException
Interface InputStream, methode read(byte bbuf[],int offset,int len) Remplit au mieux le tableau passe en parametre.

Overrides:
read in class java.io.FilterInputStream
Parameters:
le - buffer a remplir
offset - position dans le buffer
len - nombre d'octets a lire au mieux
le - nombre d'octets effectivement lus
Throws:
java.io.IOException

readFully

public void readFully(byte[] buf)
               throws java.io.IOException
Remplit le tableau passe en parametre d'un nombre precis d'octets.

Parameters:
le - buffer a remplir
Throws:
java.io.IOException

readFully

public void readFully(byte[] buf,
                      int offset,
                      int len)
               throws java.io.IOException
Remplit le tableau passe en parametre d'un nombre precis d'octets.

Parameters:
le - buffer a remplir
offset - position dans le buffer
len - nombre d'octets a lire au mieux
Throws:
java.io.IOException

readFully

public byte[] readFully()
Lecture de la totalite du flux dans un tableau de bytes sans savoir a priori la taille du flux La lecture se fait dans un vecteur de blocs que l'on concatene a la fin de la lecture

Returns:
le tableau de byte

gets

public java.lang.String gets()
                      throws java.io.IOException
Retourne la prochaine ligne du stream

Returns:
la ligne lue,
Throws:
java.io.IOException

decodeType

public static java.lang.String decodeType(long type)
Affichage "en clair" du type de fichier en fonction du cahmp de bits retourne par getType()

Returns:
une chaine decrivant le type de fichier

main

public static void main(java.lang.String[] args)


Copyright © 2009 UDS/CNRS