APIdia Launch Partner
Top Description Inners Methods
jdk.internal.org.jline.reader

public Interface History

extends Iterable<History.Entry>
Known Direct Implementers
jdk.internal.org.jline.reader.impl.history.DefaultHistory
Imports
java.io.IOException, java.nio.file.Path, java.time.Instant, java.util.Iterator, .ListIterator

Console history.
Authors
Marc Prud'hommeaux, Jason Dillon
Since
2.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Method Summary

Modifier and TypeMethod and Description
public default void
add(String line)

public void
add(Instant time, String line)

public void
append(Path
History file
file
,
boolean
If true incremental append operation is performed.
incremental
)

Append history to the file.

public void
attach(LineReader
the reader to attach to
reader
)

Initialize the history for the given reader.

public String

Returns:

the content of the current buffer
current
()

Return the content of the current buffer.

public int
public String
get(int index)

public int
public default boolean
public default boolean

Returns:

true if the given entry should be persisted, false otherwise
isPersistable
(History.Entry
the entry to check
entry
)

Check if an entry should be persisted or not.

public ListIterator<History.Entry>
iterator(int index)

public default ListIterator<History.Entry>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public int
last()

public void
load()

Load history.

public boolean

Returns:

Returns true if the index was moved.
moveTo
(int
The index to move to.
index
)

Move to the specified index in the history

public void
moveToEnd()

Move to the end of the history buffer.

public boolean

Returns:

Return false if there are no iterator in the history or if the history is already at the beginning.
moveToFirst
()

Moves the history index to the first entry.

public boolean

Returns:

Returns false if there were no history iterator or the history index was already at the last entry.
moveToLast
()

This moves the history to the last entry.

public boolean

Returns:

true if we successfully went to the next element
next
()

Move the pointer to the next element in the buffer.

public boolean

Returns:

true if we successfully went to the previous element
previous
()

Move the pointer to the previous element in the buffer.

public void
purge()

Purge history.

public void
read(Path
History file
file
,
boolean
If true, duplicate history entries will be discarded
checkDuplicates
)

Read history from the file.

public void
resetIndex()

Reset index after remove

public default Iterator<History.Entry>
public default Iterator<History.Entry>
reverseIterator(int index)

public void
save()

Save history.

public int
size()

public void
write(Path
History file
file
,
boolean
If true incremental write operation is performed.
incremental
)

Write history to the file.

Inherited from java.lang.Iterable:
forEachspliterator

Method Detail

addback to summary
public default void add(String line)
addback to summary
public void add(Instant time, String line)
appendback to summary
public void append(Path file, boolean incremental) throws IOException

Append history to the file. If incremental only the events that are new since the last incremental operation to the file are added.

Parameters
file:Path

History file

incremental:boolean

If true incremental append operation is performed.

Exceptions
IOException:
if a problem occurs
attachback to summary
public void attach(LineReader reader)

Initialize the history for the given reader.

Parameters
reader:LineReader

the reader to attach to

currentback to summary
public String current()

Return the content of the current buffer.

Returns:String

the content of the current buffer

firstback to summary
public int first()
getback to summary
public String get(int index)
indexback to summary
public int index()
isEmptyback to summary
public default boolean isEmpty()
isPersistableback to summary
public default boolean isPersistable(History.Entry entry)

Check if an entry should be persisted or not.

Parameters
entry:History.Entry

the entry to check

Returns:boolean

true if the given entry should be persisted, false otherwise

iteratorback to summary
public ListIterator<History.Entry> iterator(int index)
iteratorback to summary
public default ListIterator<History.Entry> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

lastback to summary
public int last()
loadback to summary
public void load() throws IOException

Load history.

Exceptions
IOException:
if a problem occurs
moveToback to summary
public boolean moveTo(int index)

Move to the specified index in the history

Parameters
index:int

The index to move to.

Returns:boolean

Returns true if the index was moved.

moveToEndback to summary
public void moveToEnd()

Move to the end of the history buffer. This will be a blank entry, after all of the other iterator.

moveToFirstback to summary
public boolean moveToFirst()

Moves the history index to the first entry.

Returns:boolean

Return false if there are no iterator in the history or if the history is already at the beginning.

moveToLastback to summary
public boolean moveToLast()

This moves the history to the last entry. This entry is one position before the moveToEnd() position.

Returns:boolean

Returns false if there were no history iterator or the history index was already at the last entry.

nextback to summary
public boolean next()

Move the pointer to the next element in the buffer.

Returns:boolean

true if we successfully went to the next element

previousback to summary
public boolean previous()

Move the pointer to the previous element in the buffer.

Returns:boolean

true if we successfully went to the previous element

purgeback to summary
public void purge() throws IOException

Purge history.

Exceptions
IOException:
if a problem occurs
readback to summary
public void read(Path file, boolean checkDuplicates) throws IOException

Read history from the file. If checkDuplicates is true only the events that are not contained within the internal list are added.

Parameters
file:Path

History file

checkDuplicates:boolean

If true, duplicate history entries will be discarded

Exceptions
IOException:
if a problem occurs
resetIndexback to summary
public void resetIndex()

Reset index after remove

reverseIteratorback to summary
public default Iterator<History.Entry> reverseIterator()
reverseIteratorback to summary
public default Iterator<History.Entry> reverseIterator(int index)
saveback to summary
public void save() throws IOException

Save history.

Exceptions
IOException:
if a problem occurs
sizeback to summary
public int size()
writeback to summary
public void write(Path file, boolean incremental) throws IOException

Write history to the file. If incremental only the events that are new since the last incremental operation to the file are added.

Parameters
file:Path

History file

incremental:boolean

If true incremental write operation is performed.

Exceptions
IOException:
if a problem occurs
jdk.internal.org.jline.reader back to summary

public Interface History.Entry

Known Direct Implementers
jdk.internal.org.jline.reader.impl.history.DefaultHistory.EntryImpl

Method Summary

Modifier and TypeMethod and Description
public int
public String
line()

public Instant
time()

Method Detail

indexback to summary
public int index()
lineback to summary
public String line()
timeback to summary
public Instant time()