Static utility methods for CHunks
More...
|
static byte[] | ToBytes (String x) |
| Converts to bytes using Latin1 (ISO-8859-1)
|
|
static String | ToString (byte[] x) |
| Converts to String using Latin1 (ISO-8859-1)
|
|
static String | ToString (byte[] x, int offset, int len) |
| Converts to String using Latin1 (ISO-8859-1)
|
|
static byte[] | ToBytesUTF8 (String x) |
| Converts to bytes using UTF-8
|
|
static String | ToStringUTF8 (byte[] x) |
| Converts to string using UTF-8
|
|
static String | ToStringUTF8 (byte[] x, int offset, int len) |
| Converts to string using UTF-8
|
|
static void | WriteBytesToStream (Stream stream, byte[] bytes) |
| Writes full array of bytes to stream
|
|
static bool | IsCritical (String id) |
| Critical chunks: first letter is uppercase
|
|
static bool | IsPublic (String id) |
| Public chunks: second letter is uppercase
|
|
static bool | IsSafeToCopy (String id) |
| Safe to copy chunk: fourth letter is lower case
|
|
static bool | IsUnknown (PngChunk chunk) |
| We consider a chunk as "unknown" if our chunk factory (even when it has been augmented by client code) doesn't recognize it
|
|
static int | PosNullByte (byte[] bytes) |
| Finds position of null byte in array
|
|
static bool | ShouldLoad (String id, ChunkLoadBehaviour behav) |
| Decides if a chunk should be loaded, according to a ChunkLoadBehaviour
|
|
static List< PngChunk > | FilterList (List< PngChunk > list, ChunkPredicate predicateKeep) |
| Filters a list of Chunks, keeping those which match the predicate
|
|
static int | TrimList (List< PngChunk > list, ChunkPredicate predicateRemove) |
| Filters a list of Chunks, removing those which match the predicate
|
|
static bool | Equivalent (PngChunk c1, PngChunk c2) |
| Ad-hoc criteria for 'equivalent' chunks.
|
|
static bool | IsText (PngChunk c) |
|
Static utility methods for CHunks
Client code should rarely need this, see PngMetada and ChunksList
static byte [] Hjg.Pngcs.Chunks.ChunkHelper.ToBytes |
( |
String |
x | ) |
|
|
static |
Converts to bytes using Latin1 (ISO-8859-1)
- Parameters
-
- Returns
static String Hjg.Pngcs.Chunks.ChunkHelper.ToString |
( |
byte[] |
x | ) |
|
|
static |
Converts to String using Latin1 (ISO-8859-1)
- Parameters
-
- Returns
static String Hjg.Pngcs.Chunks.ChunkHelper.ToString |
( |
byte[] |
x, |
|
|
int |
offset, |
|
|
int |
len |
|
) |
| |
|
static |
Converts to String using Latin1 (ISO-8859-1)
- Parameters
-
- Returns
static byte [] Hjg.Pngcs.Chunks.ChunkHelper.ToBytesUTF8 |
( |
String |
x | ) |
|
|
static |
Converts to bytes using UTF-8
- Parameters
-
- Returns
static String Hjg.Pngcs.Chunks.ChunkHelper.ToStringUTF8 |
( |
byte[] |
x | ) |
|
|
static |
Converts to string using UTF-8
- Parameters
-
- Returns
static String Hjg.Pngcs.Chunks.ChunkHelper.ToStringUTF8 |
( |
byte[] |
x, |
|
|
int |
offset, |
|
|
int |
len |
|
) |
| |
|
static |
Converts to string using UTF-8
- Parameters
-
- Returns
static void Hjg.Pngcs.Chunks.ChunkHelper.WriteBytesToStream |
( |
Stream |
stream, |
|
|
byte[] |
bytes |
|
) |
| |
|
static |
Writes full array of bytes to stream
- Parameters
-
static bool Hjg.Pngcs.Chunks.ChunkHelper.IsCritical |
( |
String |
id | ) |
|
|
static |
Critical chunks: first letter is uppercase
- Parameters
-
- Returns
static bool Hjg.Pngcs.Chunks.ChunkHelper.IsPublic |
( |
String |
id | ) |
|
|
static |
Public chunks: second letter is uppercase
- Parameters
-
- Returns
static bool Hjg.Pngcs.Chunks.ChunkHelper.IsSafeToCopy |
( |
String |
id | ) |
|
|
static |
Safe to copy chunk: fourth letter is lower case
- Parameters
-
- Returns
static bool Hjg.Pngcs.Chunks.ChunkHelper.IsUnknown |
( |
PngChunk |
chunk | ) |
|
|
static |
We consider a chunk as "unknown" if our chunk factory (even when it has been augmented by client code) doesn't recognize it
- Parameters
-
- Returns
static int Hjg.Pngcs.Chunks.ChunkHelper.PosNullByte |
( |
byte[] |
bytes | ) |
|
|
static |
Finds position of null byte in array
- Parameters
-
- Returns
- -1 if not found
static bool Hjg.Pngcs.Chunks.ChunkHelper.ShouldLoad |
( |
String |
id, |
|
|
ChunkLoadBehaviour |
behav |
|
) |
| |
|
static |
Decides if a chunk should be loaded, according to a ChunkLoadBehaviour
- Parameters
-
- Returns
Filters a list of Chunks, keeping those which match the predicate
The original list is not altered
- Parameters
-
- Returns
Filters a list of Chunks, removing those which match the predicate
The original list is not altered
- Parameters
-
- Returns
static bool Hjg.Pngcs.Chunks.ChunkHelper.Equivalent |
( |
PngChunk |
c1, |
|
|
PngChunk |
c2 |
|
) |
| |
|
static |
Ad-hoc criteria for 'equivalent' chunks.
Two chunks are equivalent if they have the same Id AND either: 1. they are Single 2. both are textual and have the same key 3. both are SPLT and have the same palette name Bear in mind that this is an ad-hoc, non-standard, nor required (nor wrong) criterion. Use it only if you find it useful. Notice that PNG allows to have repeated textual keys with same keys.
- Parameters
-
- Returns
- true if equivalent
static bool Hjg.Pngcs.Chunks.ChunkHelper.IsText |
( |
PngChunk |
c | ) |
|
|
static |