public final class Stream
extends java.lang.Object
Protocols singleton.Protocols| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
LINE_SEPARATOR |
| Constructor and Description |
|---|
Stream(java.io.InputStream is,
java.lang.String name) |
Stream(java.lang.String path) |
Stream(java.lang.String folder,
java.lang.String filename) |
| Modifier and Type | Method and Description |
|---|---|
void |
addStreamCallback(IStreamCallback streamCallback) |
static java.lang.String |
appendsSeparator(java.lang.String path)
Appends a file separator at the end of the path.
|
java.net.URL |
buildURL()
Create an URL object from a path.
|
Stream |
clone() |
void |
close()
Close the
InputStream opened |
static void |
copy(java.io.File src,
java.io.File dst) |
static void |
copy(java.io.InputStream in,
java.io.OutputStream out)
Copy the
InputStream to the OutputStream. |
java.io.File |
copyTo(java.io.File fileOfDir,
boolean forceFileName) |
void |
copyTo(java.io.OutputStream os) |
void |
copyTo(Stream stream) |
boolean |
equals(java.lang.Object obj) |
boolean |
exists() |
Stream |
flattenRelativePath(char pathSeparator)
Flatten relative path '..'
|
java.lang.String |
getExpectedName() |
java.lang.String |
getExtension() |
java.lang.String |
getInputStreamName()
Valid after openStream is called
|
long |
getInputStreamPosition()
Valid after openStream is called
|
long |
getInputStreamSize()
Valid after openStream is called
|
long |
getInputStreamTimeStamp() |
java.lang.String |
getLocation() |
java.lang.String |
getName() |
java.lang.String |
getNameWithoutExtension() |
java.lang.String |
getPath() |
Stream |
getRealStream() |
java.io.InputStream |
getStream() |
int |
hashCode() |
static boolean |
isTrackStreamPosition() |
java.io.InputStream |
open()
Open the stream, using the protocols defined in
Protocols. |
java.io.InputStream |
open(boolean headerOnly)
Open the stream, using the protocols defined in
Protocols. |
java.io.InputStream |
open(boolean headerOnly,
boolean trackPosition)
Open the stream, using the protocols defined in
Protocols. |
java.io.OutputStream |
openOut()
Open the stream for writing.
|
byte[] |
readFully()
Read the contents of the
InputStream into a byte array |
Stream |
relativize(Stream root) |
void |
removeCacheStreamCallback() |
static java.lang.String |
removeFirstSeparator(java.lang.String path)
Remove the file separator at the end of the path.
|
static java.lang.String |
removeLastSeparator(java.lang.String path)
Remove the file separator at the end of the path.
|
void |
removeStreamCallback(IStreamCallback streamCallback) |
static void |
setCacheStreamCallback(IStreamCallback cacheStreamCallback)
Default callback used for cache system.
|
static void |
setTrackStreamPosition(boolean enable) |
static java.lang.String |
streamToString(Stream s) |
java.lang.String |
toString() |
Stream |
trimExtension() |
Stream |
withExtension(java.lang.String ext) |
public Stream(java.io.InputStream is,
java.lang.String name)
public Stream(java.lang.String path)
public Stream(java.lang.String folder,
java.lang.String filename)
public static final boolean isTrackStreamPosition()
public static final void setTrackStreamPosition(boolean enable)
enable - enable stream position tracking. Default value is false.public static final void setCacheStreamCallback(IStreamCallback cacheStreamCallback)
public final Stream clone()
clone in class java.lang.Objectpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic final java.lang.String toString()
toString in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Objectpublic final void addStreamCallback(IStreamCallback streamCallback)
public final void removeStreamCallback(IStreamCallback streamCallback)
public final void removeCacheStreamCallback()
public final Stream getRealStream()
public final java.io.InputStream open()
throws java.io.IOException
Protocols.java.io.IOExceptionpublic final java.io.InputStream open(boolean headerOnly)
throws java.io.IOException
Protocols.headerOnly - false stream opening for reading, and have size, timestamp, ... informations.java.io.IOExceptionpublic final java.io.InputStream open(boolean headerOnly,
boolean trackPosition)
throws java.io.IOException
Protocols.headerOnly - false stream opening for reading, and have size, timestamp, ... informations.
true to indicate to open to obtains ONLY size, timestamp, ... informations BUT reading will be impossible.trackPosition - enable stream position track for this Stream,
getInputStreamPosition() will return the actual stream position in a thread safe way.java.io.IOExceptionpublic final java.io.OutputStream openOut()
throws java.io.IOException
OutputStream must be close externally.close() will not closed the OutputStream returned.OutputStream openedjava.io.IOExceptionpublic final java.net.URL buildURL()
throws java.io.IOException
java.io.IOException - when an URL can't be createdpublic final long getInputStreamSize()
java.lang.IllegalStateException - if stream is not openedopen()public final long getInputStreamPosition()
Stream#setTrackStreamPosition(boolean).java.lang.IllegalStateException - if stream is not openedopen(),
setTrackStreamPosition(boolean),
isTrackStreamPosition()public final java.lang.String getInputStreamName()
java.lang.IllegalStateException - if stream is not openedopen()public final long getInputStreamTimeStamp()
java.lang.IllegalStateException - if stream is not openedpublic final java.io.InputStream getStream()
public final void close()
InputStream openedopen(),
open(boolean),
open(boolean, boolean)public final boolean exists()
Stream exists and can be openedpublic final java.io.File copyTo(java.io.File fileOfDir,
boolean forceFileName)
throws java.io.FileNotFoundException,
java.io.IOException
fileOfDir - destination file or folderforceFileName - use the name of the specified fileFile written tojava.io.FileNotFoundExceptionjava.io.IOExceptionpublic final void copyTo(java.io.OutputStream os)
throws java.io.IOException
java.io.IOExceptionpublic final void copyTo(Stream stream) throws java.io.IOException
java.io.IOExceptionpublic final byte[] readFully()
throws java.io.IOException
InputStream into a byte arrayjava.io.IOExceptionpublic final java.lang.String getName()
Streampublic final java.lang.String getNameWithoutExtension()
Stream, extension removedpublic final java.lang.String getExtension()
Streampublic final java.lang.String getLocation()
Stream without the namepublic final java.lang.String getPath()
Streampublic final java.lang.String getExpectedName()
public final Stream withExtension(java.lang.String ext)
ext - new extensionStream object with the specified extensionpublic final Stream trimExtension()
Stream object with the extension removed, or this if no extension foundpublic final Stream flattenRelativePath(char pathSeparator)
Stream is supposed to have / separatorpublic static void copy(java.io.InputStream in,
java.io.OutputStream out)
throws java.io.IOException
InputStream to the OutputStream.
Streams are not closedjava.io.IOExceptionpublic static void copy(java.io.File src,
java.io.File dst)
throws java.io.FileNotFoundException,
java.io.IOException
java.io.FileNotFoundExceptionjava.io.IOExceptionpublic static final java.lang.String streamToString(Stream s) throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String appendsSeparator(java.lang.String path)
path is returned.public static java.lang.String removeLastSeparator(java.lang.String path)
path is returned.public static java.lang.String removeFirstSeparator(java.lang.String path)
path is returned.Bonzai Engine 1.3.4 11/12/2015 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2015 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com