Skip to content

Commit

Permalink
Code Refactored. Removed unnecessary methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
aratikakadiya committed Dec 18, 2024
1 parent febce06 commit c7fbcee
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@ void write(T tm, OutputStream out)
void write(T tm, OutputStream out, Long maxrec)
throws IOException;

void write(T tm, Writer out)
throws IOException;

void write(T tm, Writer out, Long maxrec)
throws IOException;

/**
* Write the Throwable to the OutputStream
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,11 @@ public void write(VOTableDocument vot, OutputStream out, Long maxrec)
write(vot, writer, maxrec);
}

@Override
public void write(VOTableDocument vot, Writer out)
throws IOException {
write(vot, out, null);
}

@Override
public void write(VOTableDocument votable, Writer writer, Long maxrec)
throws IOException {
if (formatFactory == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public void write(VOTableDocument voTableDocument, OutputStream out, Long maxRec
votableWriter.write(voTableDocument, stringWriter, maxRec);

Map<String, String> customMetaData = new HashMap<>();
customMetaData.put("votable", stringWriter.toString());
customMetaData.put("IVOA.VOTable-Parquet.version", "1.0");
customMetaData.put("IVOA.VOTable-Parquet.content", stringWriter.toString());

try (org.apache.parquet.hadoop.ParquetWriter<GenericRecord> writer = AvroParquetWriter.<GenericRecord>builder(outputFile)
.withSchema(schema)
Expand Down Expand Up @@ -117,16 +118,6 @@ public void write(VOTableDocument voTableDocument, OutputStream out, Long maxRec
out.close();
}

@Override
public void write(VOTableDocument voTableDocument, Writer out) {
throw new UnsupportedOperationException("This method for Parquet Writer is not supported.");
}

@Override
public void write(VOTableDocument voTableDocument, Writer out, Long maxRec) {
throw new UnsupportedOperationException("This method for Parquet Writer is not supported.");
}

@Override
public void write(Throwable thrown, OutputStream output) throws IOException {
throw new UnsupportedOperationException("This method for Parquet Writer is not yet supported.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ public void write(VOTableDocument votable, OutputStream ostream, Long maxrec)
* @param writer Writer to write to.
* @throws IOException if problem writing to the writer.
*/
@Override
public void write(VOTableDocument votable, Writer writer)
throws IOException {
write(votable, writer, Long.MAX_VALUE);
Expand All @@ -227,7 +226,6 @@ public void write(VOTableDocument votable, Writer writer)
* @param maxrec maximum number of rows to write.
* @throws IOException if problem writing to the writer.
*/
@Override
public void write(VOTableDocument votable, Writer writer, Long maxrec)
throws IOException {
if (formatFactory == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void testReadWriteCSV()
vot.setTableData(new VOTableReaderWriterTest.TestTableData());

StringWriter sw = new StringWriter();
TableWriter<VOTableDocument> writer = new AsciiTableWriter(AsciiTableWriter.ContentType.CSV);
AsciiTableWriter writer = new AsciiTableWriter(AsciiTableWriter.ContentType.CSV);

Assert.assertEquals("Should be csv extension.", "csv",
writer.getExtension());
Expand Down Expand Up @@ -181,7 +181,7 @@ public void testReadWriteCSV_NoFields()
vot.setTableData(new VOTableReaderWriterTest.TestTableData());

StringWriter sw = new StringWriter();
TableWriter<VOTableDocument> writer = new AsciiTableWriter(AsciiTableWriter.ContentType.CSV);
AsciiTableWriter writer = new AsciiTableWriter(AsciiTableWriter.ContentType.CSV);

Assert.assertEquals("Should be csv extension.", "csv",
writer.getExtension());
Expand Down Expand Up @@ -225,7 +225,7 @@ public void testReadWriteTSV()
vot.setTableData(new VOTableReaderWriterTest.TestTableData());

StringWriter sw = new StringWriter();
TableWriter<VOTableDocument> writer = new AsciiTableWriter(AsciiTableWriter.ContentType.TSV);
AsciiTableWriter writer = new AsciiTableWriter(AsciiTableWriter.ContentType.TSV);

Assert.assertEquals("Should be tsv extension.", "tsv",
writer.getExtension());
Expand Down Expand Up @@ -270,7 +270,7 @@ public void testReadWriteWithMax()
vot.setTableData(new VOTableReaderWriterTest.TestTableData(maxrec + 1));

StringWriter sw = new StringWriter();
TableWriter<VOTableDocument> writer = new AsciiTableWriter(AsciiTableWriter.ContentType.CSV);
AsciiTableWriter writer = new AsciiTableWriter(AsciiTableWriter.ContentType.CSV);

Assert.assertEquals("Should be csv extension.", "csv",
writer.getExtension());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void testReadWriteVOTable() throws Exception {

// Write VOTable to xml.
StringWriter sw = new StringWriter();
TableWriter<VOTableDocument> writer = new VOTableWriter();
VOTableWriter writer = new VOTableWriter();
writer.write(expected, sw);
String xml = sw.toString();
log.debug("XML: \n\n" + xml);
Expand Down Expand Up @@ -206,7 +206,7 @@ public void testReadWriteVOTableWithMax() throws Exception {

// Write VOTable to xml.
StringWriter sw = new StringWriter();
TableWriter<VOTableDocument> writer = new VOTableWriter();
VOTableWriter writer = new VOTableWriter();
writer.write(expected, sw, maxrec);
String xml = sw.toString();
log.info("XML: \n\n" + xml);
Expand Down Expand Up @@ -254,7 +254,7 @@ public void testReadWriteVOTableWithIterationFail() throws Exception {

// Write VOTable to xml.
StringWriter sw = new StringWriter();
TableWriter<VOTableDocument> writer = new VOTableWriter();
VOTableWriter writer = new VOTableWriter();
writer.setFormatFactory(new BrokenFormatFactory());
writer.write(expected, sw);
String xml = sw.toString();
Expand Down Expand Up @@ -375,7 +375,7 @@ public void testReadWriteVOTableArraysize() throws Exception {

// Write VOTable to xml.
StringWriter sw = new StringWriter();
TableWriter<VOTableDocument> writer = new VOTableWriter();
VOTableWriter writer = new VOTableWriter();
writer.write(expected, sw);
String xml = sw.toString();
log.debug("XML: \n\n" + xml);
Expand Down

0 comments on commit c7fbcee

Please sign in to comment.