- 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
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/mail/util/SharedByteArrayInputStream.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.