picture.filetype
Class PGMPictureType

java.lang.Object
  |
  +--picture.filetype.PictureType
        |
        +--picture.filetype.PGMPictureType

public class PGMPictureType
extends PictureType

PictureType-Unterklasse für PGM-Dateien.


Field Summary
static int ASCII
           
static int RAW
           
protected static int VALUES_PER_LINE
           
 
Constructor Summary
PGMPictureType()
           
 
Method Summary
 java.lang.String getDescription()
          Beschreibung des Bildtyps.
 java.lang.String getExtension()
          Liefert die Dateiendung zurück.
 DialogPane getSaveOptionsPane(javax.swing.JFrame f, Picture p)
          Liefert einen Speichern-Optionendialog zurück (null, falls es keinen gibt).
static void init()
          Dummy zum Aufrufen des Static-Initializers ...
 Picture load(java.io.InputStream origin)
          Lädt ein Bild im entsprechenden Format.
protected static int readASCIINumber(char c, java.io.InputStream in)
          Reads inputStream up to next whitespace or comment (= "#" "\n") character.
protected  double readRawValue(java.io.InputStream in, int pw, double scale, double offset)
           
 void save(Picture p, PictureProperty pp, java.io.OutputStream origout)
          Speichert das übergebene Bild im entsprechenden Format mit Optionen ab.
protected  void saveRawPixel(java.io.OutputStream out, long p, int pw)
           
protected static char skipWhitespacesGetComments(java.io.InputStream in, java.util.Vector comments)
          Skips whitespaces and comments (= "#" "\n").
protected static java.lang.String[] vectorToStringArray(java.util.Vector v)
          Converts a vector of strings to String[].
protected  void writeASCII(java.io.OutputStream out, Picture p, int valuesPerLine, double min, double max, long mg)
           
protected static void writeNumber(java.io.OutputStream out, long i)
          Writes a number as ASCII characters to specified OutputStream.
protected  void writeRaw(java.io.OutputStream out, Picture p, double min, double max, long mg)
           
protected static void writeString(java.io.OutputStream out, java.lang.String s)
          Writes a string to specified OutputStream.
 
Methods inherited from class picture.filetype.PictureType
save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASCII

public static final int ASCII

RAW

public static final int RAW

VALUES_PER_LINE

protected static final int VALUES_PER_LINE
Constructor Detail

PGMPictureType

public PGMPictureType()
Method Detail

init

public static final void init()
Dummy zum Aufrufen des Static-Initializers ...

getExtension

public java.lang.String getExtension()
Description copied from class: PictureType
Liefert die Dateiendung zurück.
Overrides:
getExtension in class PictureType
Following copied from class: picture.filetype.PictureType
Returns:
Dateiendung.

getDescription

public java.lang.String getDescription()
Description copied from class: PictureType
Beschreibung des Bildtyps.
Overrides:
getDescription in class PictureType
Following copied from class: picture.filetype.PictureType
Returns:
Kurzbeschreibung.

getSaveOptionsPane

public DialogPane getSaveOptionsPane(javax.swing.JFrame f,
                                     Picture p)
                              throws PictureException
Description copied from class: PictureType
Liefert einen Speichern-Optionendialog zurück (null, falls es keinen gibt).
Overrides:
getSaveOptionsPane in class PictureType
Following copied from class: picture.filetype.PictureType
Parameters:
owner - Parentframe
pic - zu berbeitendes Bild
Returns:
Speichern-Optionendialog

load

public Picture load(java.io.InputStream origin)
             throws PictureException,
                    java.io.IOException
Description copied from class: PictureType
Lädt ein Bild im entsprechenden Format.
Overrides:
load in class PictureType
Following copied from class: picture.filetype.PictureType
Parameters:
in - Eingabestream
Returns:
gelesenes Bild

save

public void save(Picture p,
                 PictureProperty pp,
                 java.io.OutputStream origout)
          throws PictureException,
                 java.io.IOException
Description copied from class: PictureType
Speichert das übergebene Bild im entsprechenden Format mit Optionen ab.
Overrides:
save in class PictureType
Following copied from class: picture.filetype.PictureType
Parameters:
p - Zu speicherndes Bild
p - Optionen
out - Ausgabestream

skipWhitespacesGetComments

protected static char skipWhitespacesGetComments(java.io.InputStream in,
                                                 java.util.Vector comments)
                                          throws java.io.IOException
Skips whitespaces and comments (= "#" "\n"). As length to skip is not known and file should be read only once, this method reads up to the next character. This character is returned.
Returns:
first char which is not a whitespace or a comment char.
Throws:
java.io.IOException - on reading exception (e.g. EOFException).

readASCIINumber

protected static int readASCIINumber(char c,
                                     java.io.InputStream in)
                              throws java.io.IOException,
                                     PictureException
Reads inputStream up to next whitespace or comment (= "#" "\n") character. Builds up an int by concatenating c with the following bytes from the inputStream.
Parameters:
c - Character from input stream which was already read.
dataInputStream - Stream to read on further.
Returns:
generated number.
Throws:
java.io.IOException - on reading exception (e.g. EOFException).
PictureException - if number contains non digit characters.

readRawValue

protected double readRawValue(java.io.InputStream in,
                              int pw,
                              double scale,
                              double offset)
                       throws java.io.IOException,
                              PictureException

writeString

protected static void writeString(java.io.OutputStream out,
                                  java.lang.String s)
                           throws java.io.IOException
Writes a string to specified OutputStream.
Parameters:
out - OutputStream to write to.
s - String to be written.
Throws:
java.io.IOException - Problems on writing to outputStream

saveRawPixel

protected void saveRawPixel(java.io.OutputStream out,
                            long p,
                            int pw)
                     throws java.io.IOException

writeRaw

protected void writeRaw(java.io.OutputStream out,
                        Picture p,
                        double min,
                        double max,
                        long mg)
                 throws java.io.IOException,
                        PictureException

writeASCII

protected void writeASCII(java.io.OutputStream out,
                          Picture p,
                          int valuesPerLine,
                          double min,
                          double max,
                          long mg)
                   throws java.io.IOException,
                          PictureException

writeNumber

protected static void writeNumber(java.io.OutputStream out,
                                  long i)
                           throws java.io.IOException
Writes a number as ASCII characters to specified OutputStream.
Parameters:
out - OutputStream to write to.
i - int value to be written.
Throws:
java.io.IOException - Problems on writing to outputStream

vectorToStringArray

protected static java.lang.String[] vectorToStringArray(java.util.Vector v)
Converts a vector of strings to String[].
Parameters:
v - Vector to convert.
Returns:
generated String array.