-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add PngStreamSource as alternative to PngAtOnceSource. - Not sure about keeping the at-once source. - Added first cut (incomplete!) of PngHex command-line program. - Added the missing 16-bit RGBA decoder.
- Loading branch information
Showing
20 changed files
with
406 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...va/net/ellerton/japng/util/HexHelper.java → ...et/ellerton/japng/argb8888/HexHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
api/src/main/java/net/ellerton/japng/reader/PngStreamSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package net.ellerton.japng.reader; | ||
|
||
import net.ellerton.japng.util.InputStreamSlice; | ||
|
||
import java.io.DataInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
/** | ||
* Created by aellerton on 13/06/2015. | ||
*/ | ||
public class PngStreamSource implements PngSource { | ||
final InputStream src; | ||
//private final ByteArrayInputStream bis; | ||
private final DataInputStream dis; | ||
|
||
public PngStreamSource(InputStream src) { | ||
this.src = src; | ||
//this.bis = new ByteArrayInputStream(this.bytes); // never closed because nothing to do for ByteArrayInputStream | ||
this.dis = new DataInputStream(this.src); // never closed because underlying stream doesn't need to be closed. | ||
|
||
} | ||
|
||
@Override | ||
public int getLength() { | ||
return 0; // TODO? | ||
} | ||
|
||
@Override | ||
public boolean supportsByteAccess() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public byte[] getBytes() throws IOException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public byte readByte() throws IOException { | ||
return dis.readByte(); | ||
} | ||
|
||
@Override | ||
public short readUnsignedShort() throws IOException { | ||
return (short)dis.readUnsignedShort(); | ||
} | ||
|
||
@Override | ||
public int readInt() throws IOException { | ||
return dis.readInt(); | ||
} | ||
|
||
@Override | ||
public long skip(int chunkLength) throws IOException { | ||
return dis.skip(chunkLength); | ||
} | ||
|
||
@Override | ||
public int tell() { | ||
return 0; // TODO | ||
} | ||
|
||
@Override | ||
public int available() { | ||
try { | ||
return dis.available(); // TODO: adequate? | ||
} catch (IOException e) { | ||
return 0; // TODO | ||
} | ||
} | ||
|
||
// @Override | ||
// public ByteArrayInputStream getBis() { | ||
// return null; | ||
// } | ||
|
||
@Override | ||
public DataInputStream getDis() { | ||
return dis; | ||
} | ||
|
||
@Override | ||
public InputStream slice(int dataLength) { | ||
return new InputStreamSlice(src, dataLength); | ||
} | ||
|
||
} |
Oops, something went wrong.