|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.mail.util Class SharedByteArrayInputStream
java.lang.Object java.io.InputStream java.io.ByteArrayInputStream javax.mail.util.SharedByteArrayInputStream
- All Implemented Interfaces:
- Closeable, SharedInputStream
public class SharedByteArrayInputStream
- extends ByteArrayInputStream
- implements SharedInputStream
Extends:
java.io.InputStream > java.io.ByteArrayInputStream
Implements:
SharedInputStream
实现 SharedInputStream 接口的 ByteArrayInputStream,允许在多个 reader 之间共享底层 byte 数组。
version | 1.5, 07/05/04 | |
since |
|
A ByteArrayInputStream that implements the SharedInputStream interface, allowing the underlying byte array to be shared between multiple readers.
- Since:
- JavaMail 1.4
- Version:
- 1.5, 07/05/04
- Author:
- Bill Shannon
Field Summary | |
---|---|
protected int |
start
Position within shared buffer that this stream starts at. |
Fields inherited from class java.io.ByteArrayInputStream |
---|
buf, count, mark, pos |
Constructor Summary | |
---|---|
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 from offset for length
bytes. |
Method Summary | |
---|---|
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 at start (inclusive)
up to end (exclusive). |
Methods inherited from class java.io.ByteArrayInputStream |
---|
available, close, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.io.InputStream |
---|
read |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
英文文档:
start
protected int start
- Position within shared buffer that this stream starts at.
Constructor Detail |
---|
public
SharedByteArrayInputStream(byte[] buf)
创建一个表示整个 byte 数组的 SharedByteArrayInputStream。
buf | byte 数组 |
SharedByteArrayInputStream
public SharedByteArrayInputStream(byte[] buf)
- Create a SharedByteArrayInputStream representing the entire
byte array.
- Parameters:
buf
- the byte array
public
SharedByteArrayInputStream(byte[] buf, int offset, int length)
创建一个表示部分 byte 数组(从 offset
开始的 length
个字节)的 SharedByteArrayInputStream。
buf | byte 数组 |
offset | byte 数组中距离第一个字节的偏移量 |
length | 要包含的字节数 |
SharedByteArrayInputStream
public SharedByteArrayInputStream(byte[] buf, int offset, int length)
- Create a SharedByteArrayInputStream representing the part
of the byte array from
offset
forlength
bytes.- Parameters:
buf
- the byte arrayoffset
- offset in byte array to first byte to includelength
- number of bytes to include
Method Detail |
---|
public long
getPosition()
返回 InputStream 中的当前位置,形式为距 InputStream 开头的偏移量。
return | 当前位置 |
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
public java.io.InputStream
newStream(long start, long end)
返回表示此 InputStream 数据的子集的新 InputStream,从 start
(包括)开始,一直到 end
(不包括)结束。start
必须为非负数。如果 end
为 -1,则新流的结束位置与此流相同。返回的 InputStream 也将实现 SharedInputStream 接口。
start | 起始位置 |
end | 结束位置 + 1 |
return | 新流 |
newStream
public InputStream newStream(long start, long end)
- Return a new InputStream representing a subset of the data
from this InputStream, starting at
start
(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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!