public final class TemporaryFile extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BLOCK_SIZE
The block size.
|
static int |
EMPTY_ENTRY_PADDING
The padding byte for empty entries.
|
static int |
MAX_PAGE_SIZE
The maximum page size.
|
static int |
PAGE_HEADER_EOB
The page header value which represents
END_OF_BLOCK. |
static int |
PAGE_HEADER_EOF
The page header value which represents
END_OF_FILE. |
static int |
PAGE_HEADER_SIZE
The page header size.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canWritePage(int positionInBlock,
int length)
Returns whether clients can write a content page into the current block.
|
static int |
readBlockHeader(InputStream input)
Reads and verifies the block header.
|
static int |
readPageHeader(InputStream input)
Reads a page header from the head of the stream.
|
static int |
readString(InputStream input,
Appendable appendable)
Reads a string into appendable.
|
static int |
writeBlockHeader(OutputStream output)
Writes a block header.
|
static void |
writeContentPageMark(OutputStream output,
int length)
Writes a content page header.
|
static void |
writeEndOfBlockMark(OutputStream output)
Writes an end-of-block header.
|
static int |
writeString(OutputStream output,
String string)
Writes a string.
|
public static final int BLOCK_SIZE
public static final int PAGE_HEADER_SIZE
public static final int PAGE_HEADER_EOB
END_OF_BLOCK.public static final int PAGE_HEADER_EOF
END_OF_FILE.public static final int EMPTY_ENTRY_PADDING
public static final int MAX_PAGE_SIZE
public static int writeBlockHeader(OutputStream output) throws IOException
output - the target outputIOException - if failed to writepublic static int readBlockHeader(InputStream input) throws IOException
input - the target inputIOException - if failed to readpublic static int writeString(OutputStream output, String string) throws IOException
output - the target outputstring - the contentsIOException - if failed to writepublic static int readString(InputStream input, Appendable appendable) throws IOException
input - the target inputappendable - the target appendableIOException - if failed to readpublic static boolean canWritePage(int positionInBlock,
int length)
positionInBlock - the byte position in the current blocklength - the content length in bytestrue if clients can write a content page into the current block, otherwise falsepublic static void writeContentPageMark(OutputStream output, int length) throws IOException
output - the target output streamlength - the content lengthIOException - if failed to write a page header by I/O errorpublic static void writeEndOfBlockMark(OutputStream output) throws IOException
output - the target output streamIOException - if failed to write a page header by I/O errorpublic static int readPageHeader(InputStream input) throws IOException
input - the target input streamIOException - if failed to read a page headerMAX_PAGE_SIZE,
PAGE_HEADER_EOB,
PAGE_HEADER_EOFCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.