<s>
COM	B-Library
Structured	I-Library
Storage	I-Library
(	O
variously	O
also	O
known	O
as	O
COM	B-Library
structured	I-Library
storage	I-Library
or	O
OLE	B-Operating_System
structured	O
storage	O
)	O
is	O
a	O
technology	O
developed	O
by	O
Microsoft	O
as	O
part	O
of	O
its	O
Windows	B-Application
operating	I-Application
system	I-Application
for	O
storing	O
hierarchical	O
data	O
within	O
a	O
single	O
file	B-Operating_System
.	O
</s>
<s>
Strictly	O
speaking	O
,	O
the	O
term	O
structured	O
storage	O
refers	O
to	O
a	O
set	O
of	O
COM	B-Application
interfaces	B-Application
that	O
a	O
conforming	O
implementation	O
must	O
provide	O
,	O
and	O
not	O
to	O
a	O
specific	O
implementation	O
,	O
nor	O
to	O
a	O
specific	O
file	B-Operating_System
format	O
(	O
in	O
fact	O
,	O
a	O
structured	O
storage	O
implementation	O
need	O
not	O
store	O
its	O
data	O
in	O
a	O
file	B-Operating_System
at	O
all	O
)	O
.	O
</s>
<s>
In	O
addition	O
to	O
providing	O
a	O
hierarchical	O
structure	O
for	O
data	O
,	O
structured	O
storage	O
may	O
also	O
provide	O
a	O
limited	O
form	O
of	O
transactional	B-General_Concept
support	O
for	O
data	O
access	O
.	O
</s>
<s>
Structured	O
storage	O
is	O
widely	O
used	O
in	O
Microsoft	B-Application
Office	I-Application
applications	O
,	O
although	O
newer	O
releases	O
(	O
starting	O
with	O
Office	B-Application
2007	I-Application
)	O
use	O
the	O
XML-based	O
Office	B-Operating_System
Open	I-Operating_System
XML	I-Operating_System
by	O
default	O
.	O
</s>
<s>
It	O
is	O
also	O
an	O
important	O
part	O
of	O
both	O
COM	B-Application
and	O
the	O
related	O
Object	B-Operating_System
Linking	I-Operating_System
and	I-Operating_System
Embedding	I-Operating_System
(	O
OLE	B-Operating_System
)	O
technologies	O
.	O
</s>
<s>
Other	O
notable	O
applications	O
of	O
structured	O
storage	O
include	O
SQL	O
Server	O
,	O
the	O
Windows	B-Application
shell	O
,	O
and	O
many	O
third-party	O
CAD	B-Application
programs	I-Application
.	O
</s>
<s>
Structured	O
storage	O
addresses	O
some	O
inherent	O
difficulties	O
of	O
storing	O
multiple	O
data	O
objects	O
within	O
a	O
single	O
file	B-Operating_System
.	O
</s>
<s>
One	O
difficulty	O
arises	O
when	O
an	O
object	O
persisted	O
in	O
the	O
file	B-Operating_System
changes	O
in	O
size	O
due	O
to	O
an	O
update	O
.	O
</s>
<s>
If	O
the	O
application	O
that	O
is	O
reading/writing	O
the	O
file	B-Operating_System
expects	O
the	O
objects	O
in	O
the	O
file	B-Operating_System
to	O
remain	O
in	O
a	O
certain	O
order	O
,	O
everything	O
following	O
that	O
object	O
's	O
representation	O
in	O
the	O
file	B-Operating_System
may	O
need	O
to	O
be	O
shifted	O
backward	O
to	O
make	O
room	O
if	O
the	O
object	O
grows	O
,	O
or	O
forward	O
to	O
fill	O
in	O
the	O
space	O
left	O
over	O
if	O
the	O
object	O
shrinks	O
.	O
</s>
<s>
If	O
the	O
file	B-Operating_System
is	O
large	O
,	O
this	O
could	O
result	O
in	O
a	O
costly	O
operation	O
.	O
</s>
<s>
Of	O
course	O
,	O
there	O
are	O
many	O
possible	O
solutions	O
to	O
this	O
difficulty	O
,	O
but	O
often	O
the	O
application	O
programmer	O
does	O
not	O
want	O
to	O
deal	O
with	O
low	O
level	O
details	O
such	O
as	O
binary	O
file	B-Operating_System
formats	O
.	O
</s>
<s>
A	O
stream	O
is	O
conceptually	O
very	O
similar	O
to	O
a	O
file	B-Operating_System
,	O
and	O
the	O
IStream	O
interface	O
provides	O
methods	O
for	O
reading	O
and	O
writing	O
similar	O
to	O
file	B-Operating_System
input/output	O
.	O
</s>
<s>
A	O
stream	O
could	O
reside	O
in	O
memory	B-Architecture
,	O
within	O
a	O
file	B-Operating_System
,	O
within	O
another	O
stream	O
,	O
etc.	O
,	O
depending	O
on	O
the	O
implementation	O
.	O
</s>
<s>
A	O
storage	O
is	O
conceptually	O
very	O
similar	O
to	O
a	O
directory	B-Application
on	O
a	O
file	B-Application
system	I-Application
.	O
</s>
<s>
If	O
an	O
application	O
wishes	O
to	O
persist	O
several	O
data	O
objects	O
to	O
a	O
file	B-Operating_System
,	O
one	O
way	O
to	O
do	O
so	O
would	O
be	O
to	O
open	O
an	O
IStorage	O
that	O
represents	O
the	O
contents	O
of	O
that	O
file	B-Operating_System
and	O
save	O
each	O
of	O
the	O
objects	O
within	O
a	O
single	O
IStream	O
.	O
</s>
<s>
One	O
way	O
to	O
accomplish	O
the	O
latter	O
is	O
through	O
the	O
standard	O
COM	B-Application
interface	O
IPersistStream	O
.	O
</s>
<s>
OLE	B-Operating_System
depends	O
heavily	O
on	O
this	O
model	O
to	O
embed	O
objects	O
within	O
documents	O
.	O
</s>
<s>
Microsoft	O
's	O
implementation	O
uses	O
a	O
file	B-Operating_System
format	O
known	O
as	O
compound	O
files	O
,	O
and	O
all	O
of	O
the	O
widely	O
deployed	O
structured	O
storage	O
implementations	O
read	O
and	O
write	O
this	O
format	O
.	O
</s>
<s>
Compound	O
files	O
use	O
a	O
FAT-like	O
structure	O
to	O
represent	O
storages	O
and	O
streams	O
.	O
</s>
<s>
Chunks	O
of	O
the	O
file	B-Operating_System
,	O
known	O
as	O
sectors	O
(	O
these	O
may	O
or	O
may	O
not	O
correspond	O
to	O
sectors	O
of	O
the	O
underlying	O
file	B-Application
system	I-Application
)	O
,	O
are	O
allocated	O
as	O
needed	O
to	O
add	O
new	O
streams	O
and	O
to	O
increase	O
the	O
size	O
of	O
existing	O
streams	O
.	O
</s>
<s>
Microsoft	B-Operating_System
Office	I-Operating_System
97	I-Operating_System
–	O
2003	B-General_Concept
documents	O
:	O
</s>
<s>
Microsoft	B-Application
Picture	I-Application
It	I-Application
!	I-Application
</s>
<s>
During	O
the	O
beta	O
testing	O
phase	O
of	O
Windows	B-Application
2000	I-Application
,	O
it	O
included	O
a	O
feature	O
titled	O
Native	O
Structured	O
Storage	O
(	O
NSS	O
)	O
for	O
storage	O
of	O
Structured	O
Storage	O
documents	O
(	O
like	O
the	O
binary	O
Microsoft	B-Application
Office	I-Application
formats	O
and	O
the	O
thumbs.db	O
file	B-Operating_System
Windows	B-Protocol
Explorer	I-Protocol
uses	O
to	O
cache	O
thumbnails	O
)	O
with	O
each	O
Stream	O
that	O
makes	O
up	O
a	O
document	O
stored	O
in	O
a	O
separate	O
NTFS	B-Application
data	O
stream	O
.	O
</s>
<s>
It	O
included	O
utilities	O
that	O
automatically	O
split	O
up	O
the	O
streams	O
in	O
a	O
regular	O
Structured	O
Storage	O
document	O
into	O
NTFS	B-Application
data	O
streams	O
and	O
vice	O
versa	O
.	O
</s>
<s>
–	O
Free	O
.NET	O
component	O
for	O
accessing	O
OLE	B-Operating_System
structured	O
storage	O
files	O
,	O
MPL	O
licensed	O
.	O
</s>
<s>
–	O
Java	O
implementation	O
of	O
the	O
OLE	B-Operating_System
2	O
Compound	O
Document	O
format	O
,	O
part	O
of	O
Apache	B-Language
POI	I-Language
.	O
</s>
<s>
–	O
JavaScript	O
implementation	O
of	O
the	O
OLE	B-Operating_System
2	O
Compound	O
Document	O
format	O
.	O
</s>
<s>
–	O
Python	O
implementation	O
of	O
the	O
Microsoft	O
Compound	O
File	B-Operating_System
Binary	O
(	O
CFB	O
)	O
format	O
.	O
</s>
