|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectStatic
PrjFiles
public final class PrjFiles
Parses and formats PRJ files. Those files usually have the ".prj" suffix and contain
the definition of exactly one Coordinate Reference System (CRS) in Well
Known Text (WKT) format. This class allows the definition to span many lines, but the
common practice is to provide the full WKT string on a single line.
If the definition is not a valid WKT string (during reads), or if a CRS can not be formatted as
a WKT (during writes), then the methods in this class throw a ContentFormatException.
This is a subclass of IOException and consequently does not require a try …
catch block different than the one for normal I/O operations.
Every files are expected to use the ISO-8859-1 (a.k.a. ISO-LATIN-1) encoding.
| referencing/geotk-referencing (download) | View source code for this class |
| Method Summary | |
|---|---|
static CoordinateReferenceSystem |
read(BufferedReader in,
boolean close)
Parses a PRJ file from a reader and returns its content as a coordinate reference system. |
static CoordinateReferenceSystem |
read(File file)
Parses a PRJ file and returns its content as a coordinate reference system. |
static CoordinateReferenceSystem |
read(InputStream in,
boolean close)
Parses a PRJ file from a stream and returns its content as a coordinate reference system. |
static CoordinateReferenceSystem |
read(ReadableByteChannel in,
boolean close)
Parses a PRJ file from a channel and returns its content as a coordinate reference system. |
static CoordinateReferenceSystem |
read(URL file)
Parses a PRJ file from a URL and returns its content as a coordinate reference system. |
static void |
write(CoordinateReferenceSystem crs,
File file)
Formats a coordinate reference system as a PRJ file. |
static void |
write(CoordinateReferenceSystem crs,
OutputStream out)
Formats a coordinate reference system as a PRJ file in the given stream. |
static void |
write(CoordinateReferenceSystem crs,
WritableByteChannel out)
Formats a coordinate reference system as a PRJ file in the given channel. |
static void |
write(CoordinateReferenceSystem crs,
Writer out)
Formats a coordinate reference system as a PRJ file in the given writer. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static CoordinateReferenceSystem read(File file)
throws ContentFormatException,
IOException
file - The file to parse. It usually has the ".prj" suffix,
ContentFormatException - If the content of the PRJ file is an invalid WKT.
IOException - If the parsing failed for an other raison.
public static CoordinateReferenceSystem read(URL file)
throws ContentFormatException,
IOException
file - The file to parse. It usually has the ".prj" suffix,
ContentFormatException - If the content of the PRJ file is an invalid WKT.
IOException - If the parsing failed for an other raison.
public static CoordinateReferenceSystem read(ReadableByteChannel in,
boolean close)
throws ContentFormatException,
IOException
close argument is set to
true. The later case allows this method to close the channel sooner than what could
be achieved if the channel was closed by the caller: before the WKT parsing begin.
in - The channel to read.close - Whatever this method should close the channel.
ContentFormatException - If the content of the PRJ file is an invalid WKT.
IOException - If the parsing failed for an other raison.
public static CoordinateReferenceSystem read(InputStream in,
boolean close)
throws ContentFormatException,
IOException
close argument is set to
true. The later case allows this method to close the stream sooner than what could
be achieved if the stream was closed by the caller: before the WKT parsing begin.
in - The stream to read.close - Whatever this method should close the stream.
ContentFormatException - If the content of the PRJ file is an invalid WKT.
IOException - If the parsing failed for an other raison.
public static CoordinateReferenceSystem read(BufferedReader in,
boolean close)
throws ContentFormatException,
IOException
close argument is set to
true. The later case allows this method to close the reader sooner than what could
be achieved if the reader was closed by the caller: before the WKT parsing begin.
in - The reader.close - Whatever this method should close the reader.
ContentFormatException - If the content of the PRJ file is an invalid WKT.
IOException - If the parsing failed for an other raison.
public static void write(CoordinateReferenceSystem crs,
File file)
throws ContentFormatException,
IOException
crs - The PRJ file content as a coordinate reference system.file - The file to create. It usually has the ".prj" suffix,
ContentFormatException - if the given CRS is not formattable as a WKT.
IOException - If an other error occurred while writing the file.
public static void write(CoordinateReferenceSystem crs,
WritableByteChannel out)
throws ContentFormatException,
IOException
crs - The PRJ file content as a coordinate reference system.out - The channel where to write.
ContentFormatException - if the given CRS is not formattable as a WKT.
IOException - If an other error occurred while writing the file.
public static void write(CoordinateReferenceSystem crs,
OutputStream out)
throws ContentFormatException,
IOException
crs - The PRJ file content as a coordinate reference system.out - The stream where to write.
ContentFormatException - if the given CRS is not formattable as a WKT.
IOException - If an other error occurred while writing the file.
public static void write(CoordinateReferenceSystem crs,
Writer out)
throws ContentFormatException,
IOException
crs - The PRJ file content as a coordinate reference system.out - The writer.
ContentFormatException - if the given CRS is not formattable as a WKT.
IOException - If an other error occurred while writing the file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||