- java.lang.Object
-
- java.io.InputStream
-
- java.io.ByteArrayInputStream
-
- javax.mail.util.SharedByteArrayInputStream
-
- All Implemented Interfaces:
- Closeable, AutoCloseable, SharedInputStream
public class SharedByteArrayInputStream extends ByteArrayInputStream implements SharedInputStream
A ByteArrayInputStream that implements the SharedInputStream interface, allowing the underlying byte array to be shared between multiple readers.- Since:
- JavaMail 1.4
- Author:
- Bill Shannon
-
-
Field Summary
Fields Modifier and Type Field and Description protected int
start
Position within shared buffer that this stream starts at.
-
Constructor Summary
Constructors Constructor and Description SharedByteArrayInputStream(byte[] buf)
Create a SharedByteArrayInputStream representing the entire byte array.SharedByteArrayInputStream(byte[] buf, int offset, int length)
Create a SharedByteArrayInputStream representing the part of the byte array fromoffset
forlength
bytes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description long
getPosition()
Return the current position in the InputStream, as an offset from the beginning of the InputStream.InputStream
newStream(long start, long end)
Return a new InputStream representing a subset of the data from this InputStream, starting atstart
(inclusive) up toend
(exclusive).-
Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, reset, skip
-
Methods inherited from class java.io.InputStream
read
-
-
-
-
Constructor Detail
-
SharedByteArrayInputStream
public SharedByteArrayInputStream(byte[] buf)
Create a SharedByteArrayInputStream representing the entire byte array.- Parameters:
buf
- the byte array
-
SharedByteArrayInputStream
public SharedByteArrayInputStream(byte[] buf, int offset, int length)
Create a SharedByteArrayInputStream representing the part of the byte array fromoffset
forlength
bytes.- Parameters:
buf
- the byte arrayoffset
- offset in byte array to first byte to includelength
- number of bytes to include
-
-
Method Detail
-
getPosition
public long getPosition()
Return the current position in the InputStream, as an offset from the beginning of the InputStream.- Specified by:
getPosition
in interfaceSharedInputStream
- Returns:
- the current position
-
newStream
public InputStream newStream(long start, long end)
Return a new InputStream representing a subset of the data from this InputStream, starting atstart
(inclusive) up toend
(exclusive).start
must be non-negative. Ifend
is -1, the new stream ends at the same place as this stream. The returned InputStream will also implement the SharedInputStream interface.- Specified by:
newStream
in interfaceSharedInputStream
- Parameters:
start
- the starting positionend
- the ending position + 1- Returns:
- the new stream
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/mail/util/sharedbytearrayinputstream.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.