RandomAccessReader
Vue de l’ensemble
‘RandomAccessReader’ est une classe dans Aspose.PDF FOSS pour Java.Déduit de: ‘Closeable’.
Le lecteur d’accès aléatoire pour les fichiers PDF.
Cette classe fournit 18 méthodes pour travailler avec les objets RandomAccessReader dans des programmes Java. Les méthodologies disponibles comprennent: ‘close’, ‘findBackward’, findForward' , 'fromBytes', ‘fronBythesNoCopy', ’frolFile’, 'fraStream', ''getLength, ‘getPosition’,‘‘isEOF , ''peek et ‘read 4 méthode supplémentaires. Tous les membres publics sont accessibles à toute application Java après l'installation de l’Aspose.PDF FOSS pour le package Java . Propriétés : 'eOF', "longueur’, «position’.
Propriétés
| Name | Type | Access | Description |
|---|---|---|---|
position | long | Read | Returns the current read position. |
length | long | Read | Returns the total length of the data source. |
eOF | boolean | Read | Returns {@code true} if the current position is at or past the end of data. |
méthodes
| Signature | Description |
|---|---|
fromFile(file: File) → RandomAccessReader | Creates a reader backed by a file. |
fromFile(path: Path) → RandomAccessReader | Creates a reader backed by a file. |
fromBytes(data: byte[]) → RandomAccessReader | Creates a reader backed by an in-memory byte array. |
fromBytesNoCopy(data: byte[]) → RandomAccessReader | Creates a reader over the given array WITHOUT a defensive copy. |
fromStream(is: InputStream) → RandomAccessReader | Creates a reader by reading the entire input stream into memory. |
getPosition() → long | Returns the current read position. |
getLength() → long | Returns the total length of the data source. |
seek(pos: long) | Seeks to the given absolute position. |
skip(n: long) | Advances the position by the given number of bytes. |
read() → int | Reads a single byte at the current position and advances by one. |
read(buf: byte[], off: int, len: int) → int | Reads up to {@code len} bytes into the given array. |
readFully(len: int) → byte[] | Reads exactly {@code length} bytes, throwing {@link EOFException} if not enough data is available. |
peek() → int | Reads the next byte without advancing the position. |
readLine() → String | Reads an ASCII line (terminated by LF or CR+LF). |
isEOF() → boolean | Returns {@code true} if the current position is at or past the end of data. |
findBackward(pattern: byte[], startFrom: long) → long | Searches backward from {@code startFrom} for the given byte pattern. |
findForward(pattern: byte[], startFrom: long) → long | Searches forward from the given position for the first occurrence of the pattern. |
close() | Closes this reader and releases any underlying resources. |
Voir aussi
- Aspose.PDF pour Java — API d’entreprise