Package uk.ac.starlink.ttools.example
Class AllWiseTableBuilder
- java.lang.Object
-
- uk.ac.starlink.ttools.example.AllWiseTableBuilder
-
- All Implemented Interfaces:
uk.ac.starlink.table.TableBuilder
- Direct Known Subclasses:
AllWiseTableBuilder.Count
,AllWiseTableBuilder.NoCount
public class AllWiseTableBuilder extends java.lang.Object implements uk.ac.starlink.table.TableBuilder
TableBuilder implementation for the ASCII files comprising the AllWise data release. At time of writing these files are available from http://irsadist.ipac.caltech.edu/wise-allwise/. The files are formatted as pipe-separated ASCII, and optionally compressed. Note that reading seems to be considerably faster for the gzip than for the bzip2 form of the input files (though the gzip ones are a bit bigger).For FITS output (though not colfits) two passes through the input ASCII file are required, the first one (much faster) just to count the rows. There are therefore two variants of this input handler, one which does a row count and one which does not. If the row count is known, it would be possible to adapt this handler so you tell it the row count up front and only one pass is required.
- Since:
- 6 Feb 2014
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AllWiseTableBuilder.Count
Input handler which reads AllWise ASCII files and does count the rows first.static class
AllWiseTableBuilder.NoCount
Input handler which reads AllWise ASCII files and does not count the rows first.
-
Constructor Summary
Constructors Constructor Description AllWiseTableBuilder()
Default mode constructor.AllWiseTableBuilder(java.lang.String name, boolean preCount)
Configurable constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canImport(java.awt.datatransfer.DataFlavor flavor)
static long
countLines(uk.ac.starlink.util.DataSource datsrc)
Counts the lines in the ASCII file at the given location.java.lang.String
getFormatName()
boolean
looksLikeFile(java.lang.String location)
uk.ac.starlink.table.StarTable
makeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storagePolicy)
void
streamStarTable(java.io.InputStream in, uk.ac.starlink.table.TableSink sink, java.lang.String pos)
-
-
-
Method Detail
-
canImport
public boolean canImport(java.awt.datatransfer.DataFlavor flavor)
- Specified by:
canImport
in interfaceuk.ac.starlink.table.TableBuilder
-
getFormatName
public java.lang.String getFormatName()
- Specified by:
getFormatName
in interfaceuk.ac.starlink.table.TableBuilder
-
looksLikeFile
public boolean looksLikeFile(java.lang.String location)
- Specified by:
looksLikeFile
in interfaceuk.ac.starlink.table.TableBuilder
-
makeStarTable
public uk.ac.starlink.table.StarTable makeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storagePolicy) throws java.io.IOException
- Specified by:
makeStarTable
in interfaceuk.ac.starlink.table.TableBuilder
- Throws:
java.io.IOException
-
streamStarTable
public void streamStarTable(java.io.InputStream in, uk.ac.starlink.table.TableSink sink, java.lang.String pos)
- Specified by:
streamStarTable
in interfaceuk.ac.starlink.table.TableBuilder
-
countLines
public static long countLines(uk.ac.starlink.util.DataSource datsrc) throws java.io.IOException
Counts the lines in the ASCII file at the given location.- Parameters:
datsrc
- data source- Returns:
- number of '\n'-terminated lines in the file
- Throws:
java.io.IOException
-
-