public class DelimitedRecordChannel extends Object
Allows performing record I/O operations.
A readRecord will have a readRecord separator and a field separator.
Note : this channel does not support concurrent operations, since underlying CharacterChannel is not synchronous.
Constructor and Description |
---|
DelimitedRecordChannel(CharacterChannel channel,
Format format) |
DelimitedRecordChannel(CharacterChannel channel,
String recordSeparator,
String fieldSeparator) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the record channel.
|
boolean |
hasNext()
Check whether there are more records or not.
|
String[] |
read()
Read the next readRecord.
|
void |
write(BStringArray fields)
Writes a given record to a file.
|
public DelimitedRecordChannel(CharacterChannel channel, Format format)
public DelimitedRecordChannel(CharacterChannel channel, String recordSeparator, String fieldSeparator)
public String[] read() throws IOException
Read the next readRecord.
An empty list will be returned if all the records have being processed, all records will be marked as processed if all the content have being retrieved from the provided channel.
IOException
- during I/O error.public void write(BStringArray fields) throws IOException
fields
- the list of fields composing the record.IOException
- during I/O error.public void close() throws IOException
IOException
- error occur while closing the connection.public boolean hasNext() throws IOException
IOException
- if an error occurs while reading from channel.Copyright © 2018 WSO2. All rights reserved.