public class MemoryDataStorage extends Object implements DataStorage
| Modifier and Type | Class and Description |
|---|---|
class |
MemoryDataStorage.StringListIterator
Iterator sur les donnnées.
|
| Modifier and Type | Field and Description |
|---|---|
protected static char |
escapechar |
protected List<String> |
lineIndexStorage
Stockage des numero de ligne (String) pour une recherche indexOf plus rapide.
|
protected Map<String,Integer> |
lineIndexStorageCache
Cache pour les indexOf encore plus rapide (invalidé lors d'un delete).
|
protected List<String> |
listStorage
Stockage des données.
|
protected static char |
quotechar |
protected static char |
separator |
| Constructor and Description |
|---|
MemoryDataStorage() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
String[] data)
Add new data into storage.
|
void |
add(String[] data)
Add new data into storage.
|
protected String |
arrayToString(String[] nextLine) |
String[] |
get(int index)
Get data at specified index.
|
int |
indexOf(String lineNumber)
Real storage index of lineNumber.
|
protected boolean |
isNextCharacterEscapable(String nextLine,
boolean inQuotes,
int i) |
protected boolean |
isNextCharacterEscapedQuote(String nextLine,
boolean inQuotes,
int i) |
Iterator<String[]> |
iterator() |
Iterator<String[]> |
iterator(boolean skipFirstLine)
Return a new iterator, but skip first iterator element (csv header)
by calling
next() once. |
protected String[] |
parseLine(String nextLine) |
protected StringBuilder |
processLine(String nextElement) |
String[] |
remove(int index)
Remove value at index.
|
String[] |
set(int index,
String[] element)
Replace data at specified index.
|
int |
size()
Storage size.
|
protected String[] |
stringToArray(String data) |
String |
toString() |
protected String |
writeNext(String[] nextLine) |
protected List<String> lineIndexStorage
protected Map<String,Integer> lineIndexStorageCache
protected static final char separator
protected static final char quotechar
protected static final char escapechar
public Iterator<String[]> iterator(boolean skipFirstLine)
next() once.iterator in interface DataStorageskipFirstLine - if true, skip first linepublic void add(String[] data)
DataStorageadd in interface DataStoragedata - data to addpublic void add(int index,
String[] data)
DataStorageadd in interface DataStorageindex - index to insert datadata - data to addpublic String[] get(int index)
DataStorageget in interface DataStorageindex - indexpublic int indexOf(String lineNumber)
DataStorageindexOf in interface DataStoragelineNumber - line numberpublic int size()
DataStoragesize in interface DataStoragepublic String[] set(int index, String[] element)
DataStorageset in interface DataStorageindex - indexelement - data to setpublic String[] remove(int index)
DataStorageremove in interface DataStorageindex - indexprotected StringBuilder processLine(String nextElement)
protected boolean isNextCharacterEscapedQuote(String nextLine, boolean inQuotes, int i)
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i)
Copyright © 2010–2015 Ifremer. All rights reserved.